def add_folder(self, dirname, watch=True):
        """Recursively add all files in a folder to the database

        By "all files" I mean, "all files that are resource files
        or library files". It will silently ignore files that don't
        look like they belong in the database. Pity the fool who
        uses non-standard suffixes.

        N.B. folders with names that begin with '." will be skipped
        """

        ignore_file = os.path.join(dirname, ".rfhubignore")
        exclude_patterns = []
        try:
            with open(ignore_file, "r") as f:
                exclude_patterns = []
                for line in f.readlines():
                    line = line.strip()
                    if (re.match(r'^\s*#', line)): continue
                    if len(line.strip()) > 0:
                        exclude_patterns.append(line)
        except:
            # should probably warn the user?
            pass

        for filename in os.listdir(dirname):
            path = os.path.join(dirname, filename)
            (basename, ext) = os.path.splitext(filename.lower())

            try:
                if (os.path.isdir(path)):
                    if (not basename.startswith(".")):
                        if os.access(path, os.R_OK):
                            self.add_folder(path, watch=False)
                else:
                    if ((".xml", ".robot", ".txt", ".py", ".tsv") in ext):
                        if os.access(path, os.R_OK):
                            self.add(path)
            except Exception, e:
                # I really need to get the logging situation figured out.
                print "bummer:", str(e)

        # FIXME:
        # instead of passing a flag around, I should just keep track
        # of which folders we're watching, and don't add wathers for
        # any subfolders. That will work better in the case where
        # the user accidentally starts up the hub giving the same
        # folder, or a folder and it's children, on the command line...
        if watch:
            # add watcher on normalized path
            dirname = os.path.abspath(dirname)
            event_handler = WatchdogHandler(self, dirname)
            self.observer.schedule(event_handler, dirname, recursive=True)
dataset/ETHPy150Open boakley/robotframework-hub/rfhub/kwdb.py/KeywordTable.add_folder/swapped operands of `in`