From 25744a679002a1ffb2b1e2b79bf2f78d6741e806 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Fri, 16 Nov 2018 01:35:39 -0600 Subject: [PATCH] dry-er up a wash --- gapi/drive_api.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gapi/drive_api.py b/gapi/drive_api.py index 2a33d85..1fdd2a7 100644 --- a/gapi/drive_api.py +++ b/gapi/drive_api.py @@ -36,14 +36,14 @@ class drive_api(API): self.fill_in(parent) parent = parent[sub] end = path[-1] - try: - return parent[end] - except KeyError: - self.fill_in(parent) - try: - return parent[end] - except KeyError: - raise FileNotFoundError() + for _try in range(2): + try: + return parent[end] + except KeyError: + if _try == 0: + self.fill_in(parent) + else: + raise FileNotFoundError() # finds all files and folders from a parent def fill_in(self,parent):