예제 #1
0
파일: models.py 프로젝트: frnsys/nomadic
    def walk(self):
        """walks the notebook, yielding only
        valid directories and files."""
        for root, dirs, files in os.walk(self.path.abs):
            if valid_notebook(root):
                notebooks, notes = [], []
                for dir in dirs:
                    path = os.path.join(root, dir)
                    if valid_notebook(path):
                        notebooks.append(Notebook(path))
                for file in files:
                    if valid_note(file):
                        path = os.path.join(root, file)
                        notes.append(Note(path))

                yield root, notebooks, notes
예제 #2
0
    def walk(self):
        """walks the notebook, yielding only
        valid directories and files."""
        for root, dirs, files in os.walk(self.path.abs):
            if valid_notebook(root):
                notebooks, notes = [], []
                for dir in dirs:
                    path = os.path.join(root, dir)
                    if valid_notebook(path):
                        notebooks.append(Notebook(path))
                for file in files:
                    if valid_note(file):
                        path = os.path.join(root, file)
                        notes.append(Note(path))

                yield root, notebooks, notes
예제 #3
0
파일: models.py 프로젝트: frnsys/nomadic
 def contents(self):
     """names of all files and directories
     in this notebook, _not_ recursively"""
     notebooks, notes = [], []
     for name in os.listdir(self.path.abs):
         p = os.path.join(self.path.abs, name)
         if os.path.isfile(p) and valid_note(p):
             notes.append(Note(p))
         else:
             if valid_notebook(p):
                 notebooks.append(Notebook(p))
     return notebooks, notes
예제 #4
0
 def contents(self):
     """names of all files and directories
     in this notebook, _not_ recursively"""
     notebooks, notes = [], []
     for name in os.listdir(self.path.abs):
         p = os.path.join(self.path.abs, name)
         if os.path.isfile(p) and valid_note(p):
             notes.append(Note(p))
         else:
             if valid_notebook(p):
                 notebooks.append(Notebook(p))
     return notebooks, notes