Skip to content

Commit e5d1a38

Browse files
committed
adding review suggestions
1 parent 4cdd919 commit e5d1a38

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

python-get-all-files-in-directory/create_large_dir.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
from pathlib import Path
55

66

7+
NUM_JUNK_FILES_LARGE = 300
8+
NUM_JUNK_FILES_MEDIUM = 25
9+
NUM_JUNK_FILES_SMALL = 5
10+
11+
712
@dataclass
813
class Item:
914
name: str
@@ -22,8 +27,8 @@ class Item:
2227
[
2328
Item(
2429
"temp",
25-
[Item("2", junk_files=300)],
26-
junk_files=300,
30+
[Item("2", junk_files=NUM_JUNK_FILES_LARGE)],
31+
junk_files=NUM_JUNK_FILES_LARGE,
2732
),
2833
Item("0.txt"),
2934
Item("find_me.txt"),
@@ -35,10 +40,10 @@ class Item:
3540
Item(
3641
"temporary_files",
3742
[
38-
Item("logs", junk_files=300),
39-
Item("temp", junk_files=300),
43+
Item("logs", junk_files=NUM_JUNK_FILES_LARGE),
44+
Item("temp", junk_files=NUM_JUNK_FILES_LARGE),
4045
],
41-
junk_files=25,
46+
junk_files=NUM_JUNK_FILES_MEDIUM,
4247
),
4348
Item("33.txt"),
4449
Item("34.txt"),
@@ -48,10 +53,10 @@ class Item:
4853
],
4954
),
5055
],
51-
junk_files=5,
56+
junk_files=NUM_JUNK_FILES_SMALL,
5257
),
53-
Item("temp", junk_files=300),
54-
Item("temporary_files", junk_files=300),
58+
Item("temp", junk_files=NUM_JUNK_FILES_LARGE),
59+
Item("temporary_files", junk_files=NUM_JUNK_FILES_LARGE),
5560
],
5661
)
5762

@@ -60,6 +65,7 @@ def create_item(item: Item, path_to: Path = Path("")):
6065

6166
if item.children is None and item.junk_files is None:
6267
path_to.joinpath(item.name).touch()
68+
return
6369

6470
if item.children or item.junk_files:
6571
root = path_to.joinpath(item.name)

0 commit comments

Comments
 (0)