misc: update isort to current version

* Update .pre-commit-config.yaml

* Update solaar

* Update udev.py

* Update __init__.py

* Update gtk.py

* Update i18n.py

* Update listener.py

* Update icons.py

* Update notify.py

* Update hidconsole

* Update gtk.py

* Update icons.py

Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
This commit is contained in:
ejsc1 2022-11-26 15:58:46 -03:00 committed by GitHub
parent b73030a0f1
commit 0c7a9dd0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 13 deletions

View File

@ -16,7 +16,7 @@ repos:
hooks:
- id: yapf
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8

View File

@ -21,8 +21,8 @@
def init_paths():
"""Make the app work in the source tree."""
import sys
import os.path as _path
import sys
# Python 2 need conversion from utf-8 filenames
# Python 3 might have problems converting back to UTF-8 in case of Unicode surrogates

View File

@ -107,6 +107,7 @@ def _match(action, device, filterfn):
try: # if report descriptor does not indicate HID++ capabilities then this device is not of interest to Solaar
from hid_parser import ReportDescriptor as _ReportDescriptor
# from hid_parser import Usage as _Usage
hidpp_short = hidpp_long = False
devfile = '/sys' + hid_device.get('DEVPATH') + '/report_descriptor'

View File

@ -115,8 +115,7 @@ def _receivers(dev_path=None):
def _receivers_and_devices(dev_path=None):
from logitech_receiver import Device
from logitech_receiver import Receiver
from logitech_receiver import Device, Receiver
from logitech_receiver.base import receivers_and_devices
for dev_info in receivers_and_devices():
if dev_path is not None and dev_path != dev_info.path:

View File

@ -123,9 +123,10 @@ def _parse_arguments():
# On first SIGINT, dump threads to stderr; on second, exit
def _handlesigint(signal, stack):
import faulthandler
import signal
import sys
import faulthandler
signal.signal(signal.SIGINT, signal.SIG_DFL)
if _log.isEnabledFor(_INFO):
@ -160,8 +161,9 @@ def main():
_log.warning('Solaar udev file not found in expected location')
_log.warning('See https://pwr-solaar.github.io/Solaar/installation for more information')
try:
import solaar.ui as ui
import solaar.listener as listener
import solaar.ui as ui
listener.setup_scanner(ui.status_changed, ui.error_dialog)
import solaar.upower as _upower
@ -177,6 +179,7 @@ def main():
ui.run_loop(listener.start_all, listener.stop_all, args.window != 'only', args.window != 'hide')
except Exception:
import sys
from traceback import format_exc
sys.exit('%s: error: %s' % (NAME.lower(), format_exc()))

View File

@ -28,7 +28,6 @@ from solaar import NAME as _NAME
def _find_locale_path(lc_domain):
import os.path as _path
import sys as _sys
prefix_share = _path.normpath(_path.join(_path.realpath(_sys.path[0]), '..'))
src_share = _path.normpath(_path.join(_path.realpath(_sys.path[0]), '..', 'share'))

View File

@ -397,8 +397,8 @@ def _process_receiver_event(action, device_info):
# (It would be easier to use pylibacl but adding the pylibacl dependencies
# for this special case is not good.)
try:
import subprocess
import re
import subprocess
output = subprocess.check_output(['/usr/bin/getfacl', '-p', device_info.path])
if not re.search(b'user:.+:', output):
_error_callback('permissions', device_info.path)

View File

@ -47,9 +47,9 @@ TRAY_ATTENTION = 'solaar-attention'
def _look_for_application_icons():
import os.path as _path
from os import environ as _environ
import sys as _sys
from os import environ as _environ
if _log.isEnabledFor(_DEBUG):
_log.debug('sys.path[0] = %s', _sys.path[0])
prefix_share = _path.normpath(_path.join(_path.realpath(_sys.path[0]), '..'))

View File

@ -28,7 +28,7 @@ try:
import gi
gi.require_version('Notify', '0.7')
# this import is allowed to fail, in which case the entire feature is unavailable
from gi.repository import Notify, GLib
from gi.repository import GLib, Notify
# assumed to be working since the import succeeded
available = True
@ -37,11 +37,13 @@ except (ValueError, ImportError):
available = False
if available:
from logging import getLogger, INFO as _INFO
from logging import INFO as _INFO
from logging import getLogger
_log = getLogger(__name__)
del getLogger
from solaar import NAME
from . import icons as _icons
# cache references to shown notifications here, so if another status comes

View File

@ -7,8 +7,8 @@ from __future__ import absolute_import
def init_paths():
"""Make the app work in the source tree."""
import sys
import os.path as _path
import sys
src_lib = _path.normpath(_path.join(_path.realpath(sys.path[0]), '..', 'lib'))
init_py = _path.join(src_lib, 'hidapi', '__init__.py')