diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-07 17:38:48 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-07 17:38:48 +0100 |
commit | 1977211883693ee9eb07f920de4755ecd3edc672 (patch) | |
tree | a587d90b57536e7a8eca46bc683d1a9c36690f38 | |
parent | feaa3ad83899142de96af432e15ff4660a258b32 (diff) | |
parent | 306ca7b6f8387f7c8f0e9dec176e795ab0d3f5fc (diff) | |
download | psutil-1977211883693ee9eb07f920de4755ecd3edc672.tar.gz |
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r-- | psutil/_pswindows.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index f5c81c6d..3e14bc3c 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -79,7 +79,6 @@ __extra__all__ = [ # ===================================================================== CONN_DELETE_TCB = "DELETE_TCB" -HAS_PROC_IO_PRIORITY = hasattr(cext, "proc_io_priority_get") ERROR_PARTIAL_COPY = 299 @@ -1006,23 +1005,21 @@ class Process(object): def nice_set(self, value): return cext.proc_priority_set(self.pid, value) - # available on Windows >= Vista - if HAS_PROC_IO_PRIORITY: - @wrap_exceptions - def ionice_get(self): - ret = cext.proc_io_priority_get(self.pid) - if enum is not None: - ret = IOPriority(ret) - return ret + @wrap_exceptions + def ionice_get(self): + ret = cext.proc_io_priority_get(self.pid) + if enum is not None: + ret = IOPriority(ret) + return ret - @wrap_exceptions - def ionice_set(self, ioclass, value): - if value: - raise TypeError("value argument not accepted on Windows") - if ioclass not in (IOPRIO_VERYLOW, IOPRIO_LOW, IOPRIO_NORMAL, - IOPRIO_HIGH): - raise ValueError("%s is not a valid priority" % ioclass) - cext.proc_io_priority_set(self.pid, ioclass) + @wrap_exceptions + def ionice_set(self, ioclass, value): + if value: + raise TypeError("value argument not accepted on Windows") + if ioclass not in (IOPRIO_VERYLOW, IOPRIO_LOW, IOPRIO_NORMAL, + IOPRIO_HIGH): + raise ValueError("%s is not a valid priority" % ioclass) + cext.proc_io_priority_set(self.pid, ioclass) @wrap_exceptions def io_counters(self): |