about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-10-29 00:21:12 -0500
committerStarfall <us@starfall.systems>2023-12-05 10:00:55 -0600
commit287ff07313c095fed38d26a81db878337fb2d541 (patch)
treedd881dfa2efc7dc9e152acb7a744b6606dc95559
parentc1a35008f59d53feaac6cf4c4c8893e4c956a5e8 (diff)
strike: 'import os' instead of 'from os import'
The semantics of os.listdir() here are better than Path.iterdir(), since
the former provides us paths relative to input_dir which we copy
directly over to output_dir. The pathlib version returns the full path
to input_dir/file and then we'd have to get file.name outselves.
-rwxr-xr-xstrike.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/strike.py b/strike.py
index 1bb3769..73c91de 100755
--- a/strike.py
+++ b/strike.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python3
-from os import listdir
+import os
 from time import gmtime, strftime
 from argparse import ArgumentParser
 from configparser import ConfigParser
@@ -55,7 +55,7 @@ def main():
     output_dir = basedir/config['Output']['directory']
     output_dir.mkdir(parents=True, exist_ok=True)
 
-    for file in listdir(input_dir):
+    for file in os.listdir(input_dir):
         if file in exclusions:
             continue 
         contents, meta = handle_file(input_dir/file)