def get(self, name):
        '''Get source code for a given file.
        '''
        self._code = []
        self._name = name
        if name.lower().endswith('.py'):
            self.debugf('looking for file: %s', name)
            if os.path.isabs(name):
                # XXX assert(os.path.join('', name) == name)
                ds = ('',)
            else:
                ds = self._dirs
            for d in ds:  # find file
                try:
                    t = os.path.join(d, name)
                    f = open(t, 'r')
                    s = f.readlines()
                    f.close()
                    self._code = s
                    self.debugf('found file: %s (%s)', t, plural(len(s), 'line'))
                    break
                except (IOError, OSError, EOFError):
                    pass
            else:
                self.debugf('file not found: %s', name)
Get source code for a given file.
        
recipes/Python/546532_PyChecker_postprocessor/recipe-546532.py