Skip to content

Commit

Permalink
fix ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Apr 5, 2024
1 parent cfe897e commit 034a1a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ lint-all: ## Run all linters
# ===================================================================

fix-black:
git ls-files '*.py' | xargs $(PYTHON) -m black
@git ls-files '*.py' | xargs $(PYTHON) -m black

fix-ruff:
@git ls-files '*.py' | xargs $(PYTHON) -m ruff --no-cache --fix
@git ls-files '*.py' | xargs $(PYTHON) -m ruff check --no-cache --fix

fix-unittests: ## Fix unittest idioms.
@git ls-files '*test_*.py' | xargs $(PYTHON) -m teyit --show-stats
Expand Down
6 changes: 2 additions & 4 deletions psutil/_pswindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,10 @@ def is_permission_err(exc):
# On Python 2 OSError doesn't always have 'winerror'. Sometimes
# it does, in which case the original exception was WindowsError
# (which is a subclass of OSError).
if getattr(exc, "winerror", -1) in (
return getattr(exc, "winerror", -1) in (
cext.ERROR_ACCESS_DENIED,
cext.ERROR_PRIVILEGE_NOT_HELD,
):
return True
return False
)


def convert_oserror(exc, pid=None, name=None):
Expand Down
4 changes: 1 addition & 3 deletions psutil/tests/test_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,9 +1360,7 @@ def is_storage_device(name):

def test_emulate_use_sysfs(self):
def exists(path):
if path == '/proc/diskstats':
return False
return True
return path == '/proc/diskstats'

wprocfs = psutil.disk_io_counters(perdisk=True)
with mock.patch(
Expand Down

0 comments on commit 034a1a6

Please sign in to comment.