Esempio n. 1
0
def get_non_hidden_directory_entries(path: str) -> List:
    """Build a list of entries for path."""
    entries = []

    with os.scandir(path) as it:
        for entry in it:
            if is_hidden(entry.path):
                continue
            if entry.is_dir():
                entries.append(create_dir_entry(entry))
            if entry.is_file():
                entries.append(create_file_entry(entry))

    return entries
Esempio n. 2
0
 def test_is_not_hidden(self) -> None:
     """Test if path is correctly recognized as not hidden."""
     path = "home"
     result = is_hidden(path)
     self.assertFalse(result)
Esempio n. 3
0
 def test_is_hidden(self) -> None:
     """Test if path is correctly recognized as hidden."""
     path = ".ssh"
     result = is_hidden(path)
     self.assertTrue(result)