Skip to content

Commit

Permalink
Refactor to fix flake8 W504 violation
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-hull committed Nov 4, 2018
1 parent d61301c commit 8af74e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions OPi/sysfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@

def await_permissions(path):
start_time = time.time()
while (not os.access(path, os.W_OK) and
time.time() - start_time < WAIT_PERMISSION_TIMEOUT):

def timed_out():
return time.time() - start_time >= WAIT_PERMISSION_TIMEOUT

while (not os.access(path, os.W_OK) and not timed_out()):
time.sleep(0.1)


Expand Down

0 comments on commit 8af74e4

Please sign in to comment.