Skip to content

Commit

Permalink
Apply ruff format
Browse files Browse the repository at this point in the history
Run ruff auto formatting using:
ruff format .

Related #2295
  • Loading branch information
MattHag authored and pfps committed Feb 20, 2024
1 parent 35f63ed commit 7774569
Show file tree
Hide file tree
Showing 56 changed files with 6,960 additions and 6,571 deletions.
15 changes: 8 additions & 7 deletions bin/solaar
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,25 @@ def init_paths():

except UnicodeError:
sys.stderr.write(
'ERROR: Solaar cannot recognize encoding of filesystem path, '
'this may happen because non UTF-8 characters in the pathname.\n'
"ERROR: Solaar cannot recognize encoding of filesystem path, "
"this may happen because non UTF-8 characters in the pathname.\n"
)
sys.exit(1)

prefix = _path.normpath(_path.join(_path.realpath(decoded_path), '..'))
src_lib = _path.join(prefix, 'lib')
share_lib = _path.join(prefix, 'share', 'solaar', 'lib')
prefix = _path.normpath(_path.join(_path.realpath(decoded_path), ".."))
src_lib = _path.join(prefix, "lib")
share_lib = _path.join(prefix, "share", "solaar", "lib")
for location in src_lib, share_lib:
init_py = _path.join(location, 'solaar', '__init__.py')
init_py = _path.join(location, "solaar", "__init__.py")
# print ("sys.path[0]: checking", init_py)
if _path.exists(init_py):
# print ("sys.path[0]: found", location, "replacing", sys.path[0])
sys.path[0] = location
break


if __name__ == '__main__':
if __name__ == "__main__":
init_paths()
import solaar.gtk

solaar.gtk.main()
56 changes: 30 additions & 26 deletions lib/hidapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,35 @@

import platform as _platform

if _platform.system() in ('Darwin', 'Windows'):
from hidapi.hidapi import close # noqa: F401
from hidapi.hidapi import enumerate # noqa: F401
from hidapi.hidapi import find_paired_node # noqa: F401
from hidapi.hidapi import find_paired_node_wpid # noqa: F401
from hidapi.hidapi import get_manufacturer # noqa: F401
from hidapi.hidapi import get_product # noqa: F401
from hidapi.hidapi import get_serial # noqa: F401
from hidapi.hidapi import monitor_glib # noqa: F401
from hidapi.hidapi import open # noqa: F401
from hidapi.hidapi import open_path # noqa: F401
from hidapi.hidapi import read # noqa: F401
from hidapi.hidapi import write # noqa: F401
if _platform.system() in ("Darwin", "Windows"):
from hidapi.hidapi import (
close, # noqa: F401
enumerate, # noqa: F401
find_paired_node, # noqa: F401
find_paired_node_wpid, # noqa: F401
get_manufacturer, # noqa: F401
get_product, # noqa: F401
get_serial, # noqa: F401
monitor_glib, # noqa: F401
open, # noqa: F401
open_path, # noqa: F401
read, # noqa: F401
write, # noqa: F401
)
else:
from hidapi.udev import close # noqa: F401
from hidapi.udev import enumerate # noqa: F401
from hidapi.udev import find_paired_node # noqa: F401
from hidapi.udev import find_paired_node_wpid # noqa: F401
from hidapi.udev import get_manufacturer # noqa: F401
from hidapi.udev import get_product # noqa: F401
from hidapi.udev import get_serial # noqa: F401
from hidapi.udev import monitor_glib # noqa: F401
from hidapi.udev import open # noqa: F401
from hidapi.udev import open_path # noqa: F401
from hidapi.udev import read # noqa: F401
from hidapi.udev import write # noqa: F401
from hidapi.udev import (
close, # noqa: F401
enumerate, # noqa: F401
find_paired_node, # noqa: F401
find_paired_node_wpid, # noqa: F401
get_manufacturer, # noqa: F401
get_product, # noqa: F401
get_serial, # noqa: F401
monitor_glib, # noqa: F401
open, # noqa: F401
open_path, # noqa: F401
read, # noqa: F401
write, # noqa: F401
)

__version__ = '0.9'
__version__ = "0.9"
Loading

0 comments on commit 7774569

Please sign in to comment.