From 287ff07313c095fed38d26a81db878337fb2d541 Mon Sep 17 00:00:00 2001 From: Starfall Date: Fri, 29 Oct 2021 00:21:12 -0500 Subject: 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. --- strike.py | 4 ++-- 1 file 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) -- cgit