summaryrefslogtreecommitdiff
path: root/psutil/_common.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix pylint warnings / cleanup (#2218)Giampaolo Rodola2023-04-011-2/+2
|
* When raising warning, always use stacklevel=2Giampaolo Rodola2023-03-271-1/+1
| | | | | | | | | | B028: No explicit stacklevel argument found. The warn method from the warnings module uses a stacklevel of 1 by default. This will only show a stack trace for the line on which the warn method is called. It is therefore recommended to use a stacklevel of 2 or greater to provide more information to the user. Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* fix exec() compatibility with PYPY (closes #2198)Giampaolo Rodola2023-03-071-1/+6
|
* Clearer tracebacks in case of chained exceptions (#2196)Giampaolo Rodola2023-01-241-3/+26
| | | | | | In case of exception, display a cleaner error traceback by hiding the `KeyError` bit deriving from a missed cache hit. Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* write extensive test suite for @memoize decoratorGiampaolo Rodola2022-12-151-0/+9
|
* Add in support for network interface flags. (#2037)Chris Lalancette2022-09-061-1/+2
| | | | Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* Drop Python 2.6 support (#2039)Matthieu Darbois2022-04-151-4/+1
| | | Signed-off-by: mayeut <mayeut@users.noreply.github.com>
* Fixes #2078: Import the inspect module on use (#2079)Steve Dower2022-02-231-2/+1
|
* fix py 2.7 failuresGiampaolo Rodola2022-01-161-1/+3
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* fix repr(Error): PID was not shown if PID == 0Giampaolo Rodola2022-01-151-1/+1
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* [Linux]: increase `read(2)` buffer size when reading /proc files lines (#2054)Giampaolo Rodola2022-01-151-12/+39
| | | This should help having more consistent results.
* [Linux] cat/bcat utils refactoring (#2053)Giampaolo Rodola2022-01-081-0/+24
|
* fix #2048: str(psutil.Error) raise AttributeErrorGiampaolo Rodola2022-01-071-1/+1
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* move import on top of the fileGiampaolo Rodola2021-12-311-1/+2
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* Automatically sort imports (isort CLI tool) (#2033)Giampaolo Rodola2021-12-141-1/+3
|
* PSUTIL_DEBUG: print file + line number for C ext modules (#2005)Giampaolo Rodola2021-10-261-8/+5
|
* Changes to debug() function:Giampaolo Rodola2021-10-141-1/+5
| | | | | | | | | | * use str() if exception derives from OSError / EnvironmentError. This way we will print the file name (if it exists). * use repr() for any other exception * add tests for debug() function * backport contextlib.redirect_stderr Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* add debug() prints in a couple of placesGiampaolo Rodola2021-10-141-0/+2
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* add support for MidnightBSD (#1996)Saeed Rasooli2021-10-121-1/+1
| | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* fix #1919 / Linux: sensors_battery() may raise TypeError on PureOSGiampaolo Rodola2021-10-031-1/+0
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* Improve custom error tracebacks and messages (#1992)Giampaolo Rodola2021-10-031-44/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removal of duplicated `psutil.NoSuchProcess` text. Before: ``` psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=4651, name="python") psutil.ZombieProcess: psutil.ZombieProcess process no longer exists and it's a zombie (pid=4651, name="python") psutil.AccessDenied: psutil.AccessDenied (pid=4651, name="python") psutil.TimeoutExpired: psutil.TimeoutExpired timeout after 5 seconds (pid=4651, name="python") ``` Now: ``` psutil.NoSuchProcess: process no longer exists (pid=4651, name="python") psutil.ZombieProcess: process no longer exists and it's a zombie (pid=4651, name="python") psutil.AccessDenied: (pid=4651, name="python") psutil.TimeoutExpired: timeout after 5 seconds (pid=4651, name="python") ``` --- More info if process PID has been reused: Before: ``` psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=465148) ``` Now: ``` psutil.NoSuchProcess: process no longer exists and its PID has been reused (pid=465148) ``` --- Before: ``` psutil.NoSuchProcess: psutil.NoSuchProcess no process found with pid 666 ``` Now: ``` psutil.NoSuchProcess: process PID not found (pid=666) ``` --- Before: ``` >>> psutil.NoSuchProcess(212, name="python") psutil.NoSuchProcess process no longer exists (pid=212, name='python') ``` Now: ``` >>> psutil.NoSuchProcess(212, name="python") psutil.NoSuchProcess(pid=212, name='python', msg='process no longer exists') ```
* give credits to @XuehaiPan for #1948, #1949Giampaolo Rodola2021-10-021-1/+3
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* Fix thread safety of cached functions lock-freely (#1949)Xuehai Pan2021-10-021-1/+6
| | | | Signed-off-by: XuehaiPan <XuehaiPan@pku.edu.cn>
* disk_partitions() maxfile and maxpath (#1863)Giampaolo Rodola2020-10-241-1/+2
|
* remove weird 'return xxx' left in codeGiampaolo Rodola2020-10-231-3/+0
|
* pragma no coverGiampaolo Rodola2020-10-181-1/+1
|
* add battery test; increase coverageGiampaolo Rodola2020-10-171-1/+1
|
* increase test coverageGiampaolo Rodola2020-10-171-1/+2
|
* Wheels2 (#1761)Giampaolo Rodola2020-05-181-3/+4
|
* MemoryLeakTest class enhancements (#1731)Giampaolo Rodola2020-04-231-2/+2
|
* Git hook for renamed/added/deleted files + flake8 print() + tidelift (#1704)Giampaolo Rodola2020-02-211-4/+4
|
* fix KeyErrorrelease-5.7.0Giampaolo Rodola2020-02-181-1/+1
|
* refactor print colors utilsGiampaolo Rodola2020-02-151-17/+60
|
* Add support for PyPy on Windows (#1686)Giampaolo Rodola2020-02-111-1/+7
|
* fix #1650 [Linux] sensors_temperatures() no longer emit warnings on file not ↵Giampaolo Rodola2020-02-091-2/+10
| | | | found (print debug msg instead)
* move custom exceptions in _common.pyGiampaolo Rodola2020-01-021-0/+104
|
* setup.py: print instructions if C compiler is not installedGiampaolo Rodola2019-12-281-1/+35
|
* fix #1546: usage percent may be rounded to 0 on Python 2.Giampaolo Rodola2019-06-281-4/+4
|
* Connection family/type are not converted to enums (#1535)Giampaolo Rodola2019-06-141-6/+23
|
* refactor/move some utilities into _common.pyGiampaolo Rodola2019-04-121-0/+13
|
* move bytes2human() into psutil._common and reused it from scripts dirGiampaolo Rodola2019-04-051-0/+21
|
* #1291 / OSX: mark memory_maps() as deprecated and make it alwats raise ↵Giampaolo Rodola2019-02-271-1/+1
| | | | AccessDenied
* fix #1111: use a lock to make Process.oneshot() thread safeGiampaolo Rodola2018-12-131-7/+10
|
* #1373: different approach to oneshot() cache (pass Process instances around ↵Giampaolo Rodola2018-12-131-12/+13
| | | | - which is faster)
* #1341: move open() utilities/wrappers in _common.pyGiampaolo Rodola2018-09-261-0/+18
|
* fix #1309: add STATUS_PARKED constant and fix STATUS_IDLE (both on linux)Giampaolo Rodola2018-07-251-2/+3
|
* Rename OSX to macOS (#1298)Giampaolo Rodola2018-06-261-4/+5
| | | rename OSX to macOS
* Merge branch 'master' of github.com:giampaolo/psutilGiampaolo Rodola2018-06-261-1/+1
|\
| * Osx temps (#1284)Alex Manuskin2018-06-261-1/+1
| | | | | | OSX: add temperatures() and fans()
* | little refactoringGiampaolo Rodola2018-06-261-1/+1
|/