From f4d367906319faac6db66cd00367e4e1cf0348b3 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 13 Dec 2017 13:29:13 -0800 Subject: [PATCH] Remove unnecessary amount of pathclass.Path instantiation. --- timesearch/tsdb.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/timesearch/tsdb.py b/timesearch/tsdb.py index fab0e88..d400fe0 100644 --- a/timesearch/tsdb.py +++ b/timesearch/tsdb.py @@ -176,11 +176,11 @@ class TSDB: for, and return that path. If none of them exist, then use the most preferred filepath. ''' - paths = [pathclass.Path(format.format(name=name)) for format in formats] - for path in paths: - if path.is_file: - return path - return paths[-1] + for form in formats: + path = form.format(name=name) + if os.path.isfile(path): + break + return pathclass.Path(path) @classmethod def for_subreddit(cls, name, do_create=True):