def GetAlbumDirectories(directory: pathlib.Path): """TODO.""" okay = True for subdir in fs.lsdirs(directory, recursive=True): subdir = pathlib.Path(subdir) depth = len(pathlib.Path(subdir).parts) if depth == 2: if FLAGS.update_musiclib_manifests: contents = dpack.GetFilesInDirectory(directory / subdir, ['.*']) dpack.InitManifest(directory / subdir, contents, update=True) else: if not dpack.VerifyManifest(directory / subdir): okay = False return okay
def test_lsdirs_single_file(self): self._test([], fs.lsdirs("tests/data/testdir/a"))
def test_lsdirs_bad_path(self): with self.assertRaises(OSError): fs.lsdirs("/not/a/real/path/bro")
def test_lsdirs_recursive(self): self._test(["c", "c/f", "c/f/f"], fs.lsdirs("tests/data/testdir", recursive=True))
def test_lsdirs(self): self._test(["c"], fs.lsdirs("tests/data/testdir"))
def test_lsdirs_single_file(): assert not fs.lsdirs("labm8/data/test/testdir/a")
def test_lsdirs_bad_path(): with pytest.raises(OSError): fs.lsdirs("/not/a/real/path/bro")
def test_lsdirs_recursive(): assert fs.lsdirs("labm8/data/test/testdir", recursive=True) == [ "c", "c/f", "c/f/f", ]
def test_lsdirs(): assert ["c"] == fs.lsdirs("labm8/data/test/testdir")