Skip to content

Commit

Permalink
PEP8: fix indentations and spaces in linux/application.py
Browse files Browse the repository at this point in the history
  • Loading branch information
airelil committed Feb 2, 2020
1 parent 65a62e2 commit 352be63
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pywinauto/linux/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ def __init__(self, backend="atspi", allow_magic_lookup=True):
Initialize the Application object
* **backend** is a name of used back-end (values: "atspi").
* **allow_magic_lookup** whether attribute access must turn into
child_window(best_match=...) search as fallback
* **allow_magic_lookup** whether attribute access must turn into
child_window(best_match=...) search as fallback
"""
self.process = None
self.xmlpath = ''

self._proc_descriptor = None
self.match_history = []
self.use_history = False
self.actions = None # TODO Action logger for linux
self.actions = None # TODO Action logger for linux
if backend not in registry.backends:
raise ValueError('Backend "{0}" is not registered!'.format(backend))
self.backend = registry.backends[backend]
Expand Down Expand Up @@ -122,6 +122,7 @@ def cpu_usage(self, interval=None):
raise AppNotConnected("Please use start or connect before trying "
"anything else")
proc_pid_stat = "/proc/{}/stat".format(self.process)

def read_cpu_info():
with open(proc_pid_stat, 'r') as s:
pid_info = s.read().split()
Expand All @@ -130,7 +131,7 @@ def read_cpu_info():
# return a tuple as following:
# pid utime, pid stime, total utime, total stime
return (int(pid_info[13]), int(pid_info[14]), int(info[1]), int(info[3]))

try:
before = read_cpu_info()
if not interval:
Expand Down Expand Up @@ -166,7 +167,7 @@ def kill(self, soft=False):
self._proc_descriptor = None

if not self.is_process_running():
return True # already closed
return True # already closed
status = subprocess.check_output(["kill", "-9", str(self.process)], universal_newlines=True)
if "Operation not permitted" in status:
raise Exception("Cannot kill process: {}".format(status))
Expand Down

0 comments on commit 352be63

Please sign in to comment.