diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..61fea016 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + exclude_types: + - binary + exclude: \.img$ + - id: end-of-file-fixer + exclude_types: + - binary + exclude: \.img$ + - id: check-yaml +- repo: local + hooks: + - id: pep8 + verbose: true + name: pep8 + entry: env PATH=.tox/style/bin python tools/cpep8.py + files: \.py$ + language: python diff --git a/.pylintrc b/.pylintrc index 8a8f0a31..5d7aad6e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,11 +1,11 @@ # lint Python modules using external checkers. -# +# # This is the main checker controling the other ones and the reports # generation. It is itself both a raw checker and an astng checker in order # to: # * handle message activation / deactivation at the module level # * handle some basic but necessary stats'data (number of classes, methods...) -# +# [MASTER] # Specify a configuration file. @@ -102,7 +102,7 @@ comment=no # * dangerous default values as arguments # * redefinition of function / method / class # * uses of the global statement -# +# [BASIC] # Required attributes for module, separated by a comma @@ -152,7 +152,7 @@ bad-functions=map,filter,apply,input # try to find bugs in the code using type inference -# +# [TYPECHECK] # Tells wether missing members accessed in mixin class should be ignored. A @@ -173,7 +173,7 @@ acquired-members=REQUEST,acl_users,aq_parent # * undefined variables # * redefinition of variable from builtins or from an outer scope # * use of variable before assigment -# +# [VARIABLES] # Tells wether we should check for unused import in __init__ files. @@ -190,7 +190,7 @@ additional-builtins= # checks for sign of poor/misdesign: # * number of methods, attributes, local variables... # * size, complexity of functions, methods -# +# [DESIGN] # Maximum number of arguments for function / method @@ -228,7 +228,7 @@ max-public-methods=20 # * attributes not defined in the __init__ method # * supported interfaces implementation # * unreachable code -# +# [CLASSES] # List of interface methods to ignore, separated by a comma. This is used for @@ -244,7 +244,7 @@ defining-attr-methods=__init__,__new__,setUp # * relative / wildcard imports # * cyclic imports # * uses of deprecated modules -# +# [IMPORTS] # Deprecated modules which should not be used, separated by a comma @@ -266,7 +266,7 @@ int-import-graph= # checks for: # * warning notes in the code like FIXME, XXX # * PEP 263: source code with non ascii character but no encoding declaration -# +# [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. @@ -278,7 +278,7 @@ notes=FIXME,XXX,TODO # * strict indentation # * line length # * use of <> instead of != -# +# [FORMAT] # Maximum number of characters on a single line. @@ -295,7 +295,7 @@ indent-string=' ' # checks for similarities and duplicated code. This computation may be # memory / CPU intensive, so you should disable it if you experiments some # problems. -# +# [SIMILARITIES] # Minimum lines number of a similarity. diff --git a/INSTALL b/INSTALL index a55c4d4f..fce47e9a 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ -This file describes the installation of Chirp without package management -on Linux and other Unix-like operating systems. This sort of thing may -be your only choice because 1) a package has not yet been made for your -OS or distribution, 2) the packaged version is obsolete, or 3) you want +This file describes the installation of Chirp without package management +on Linux and other Unix-like operating systems. This sort of thing may +be your only choice because 1) a package has not yet been made for your +OS or distribution, 2) the packaged version is obsolete, or 3) you want to try a daily build. @@ -14,7 +14,7 @@ python-serial python-suds (optional) python-support -For Redhat, Fedora, CentOS and related systems, the following packages +For Redhat, Fedora, CentOS and related systems, the following packages are required: (This list is incomplete. Please submit corrections.) python pygtk2 @@ -29,24 +29,23 @@ python-libxml2 libxslt-python python-suds-jurko -Once these packages are installed, you can run Chirp directly from the -distribution directory by typing "./chirpw". If you want to install it +Once these packages are installed, you can run Chirp directly from the +distribution directory by typing "./chirpw". If you want to install it properly, type this: sudo python setup.py install --record files.txt -This will install the package and create a list of files that were -added to your system. If you want to deinstall Chirp, type this: +This will install the package and create a list of files that were +added to your system. If you want to deinstall Chirp, type this: sudo xargs -0 rm -rf < files.txt -This will cause rm(1) to take its list of arguments from the file named -"files.txt" and remove those files from the system. If you forgot to -create "files.txt", you can simply reinstall the way it is shown here +This will cause rm(1) to take its list of arguments from the file named +"files.txt" and remove those files from the system. If you forgot to +create "files.txt", you can simply reinstall the way it is shown here and continue on your way. -Note: This will not uninstall directories created by the installation of -Chirp. Presence of these empty directories shouldn't be a problem, but -if they are, it's easy to go through the files.txt file, identify them, +Note: This will not uninstall directories created by the installation of +Chirp. Presence of these empty directories shouldn't be a problem, but +if they are, it's easy to go through the files.txt file, identify them, and remove them. - diff --git a/README.developers b/README.developers index e784b2ab..33d11124 100644 --- a/README.developers +++ b/README.developers @@ -28,7 +28,7 @@ the "Browser" tab in the left sidebar, which is visible when the Developer tools are enabled. The default size is 10. Values less than 4, greater than 144, or not -recognized as an integer will result in a log message and the default +recognized as an integer will result in a log message and the default size will be used. ======== @@ -37,7 +37,7 @@ This specifies the fontsize used in the hex dump/diff display which is invoked by selecting View -> Developer -> Diff tabs. The default size is 11. Values less than 4, greater than 144, or not -recognized as an integer will result in a log message and the default +recognized as an integer will result in a log message and the default size will be used. ======== @@ -60,5 +60,3 @@ Exceptions that have been observed in testing formats which are invalid in this context are caught, and the default format is used. ======== - - diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index daf56863..2052c1f8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,8 +1,8 @@ name: chirp-snap summary: A free, open-source tool for programming your amateur radio description: | - CHIRP is a free, open-source tool for programming your amateur radio. - It supports a large number of manufacturers and models, as well as + CHIRP is a free, open-source tool for programming your amateur radio. + It supports a large number of manufacturers and models, as well as provides a way to interface with multiple data sources and formats. adopt-info: chirp @@ -24,7 +24,7 @@ apps: command: bin/chirp desktop: lib/python3.10/site-packages/chirp/share/chirp.desktop extensions: - # WARNING: gnome extension is incompatible with python apps. + # WARNING: gnome extension is incompatible with python apps. - gnome plugs: - home diff --git a/tests/Python3_Driver_Testing.md b/tests/Python3_Driver_Testing.md index d2dcabef..2e82670e 100644 --- a/tests/Python3_Driver_Testing.md +++ b/tests/Python3_Driver_Testing.md @@ -465,21 +465,22 @@ For the purposes of the Python 3 effort, a "tested" radio means at least the following procedure was followed: 1. Download from the radio 1. Make some change to a memory -1. If the radio has settings support, make sure settings load and tweak one setting +1. If the radio has settings support, make sure settings load and tweak + one setting 1. Upload to the radio 1. Confirm that the changes stick and look correct, or at least are not a regression from the master py2 branch. -The drivers are all passing the automated tests, but tests with real hardware -and serial ports is important, especially around bytes-vs-string safety. +The drivers are all passing the automated tests, but tests with real +hardware and serial ports is important, especially around bytes-vs-string +safety. -To update this document, add/edit entries in `tests/py3_driver_testers.txt` and -then run `tox -e makesupported`. Commit the result (including the changes to this `.md` -file) and submit a PR. +To update this document, add/edit entries in `tests/py3_driver_testers.txt` +and then run `tox -e makesupported`. Commit the result (including the +changes to this `.md` file) and submit a PR. The "Byte Clean" flag refers to whether or not the radio has set the `NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses `MemoryMapBytes` exclusively internally. Whenever possible, all radios that are fixed for py3 should do so with this flag set to False and with the byte-native memory map. - diff --git a/tools/Makefile b/tools/Makefile index a9f08af1..df750f35 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -32,4 +32,3 @@ serialsniff: serialsniff.c clean: $(REMOVE) serialsniff *~ *.o *.bak core tags shar a.out - diff --git a/tools/icomsio.sh b/tools/icomsio.sh index f5f126db..8b111072 100755 --- a/tools/icomsio.sh +++ b/tools/icomsio.sh @@ -92,4 +92,3 @@ for usbserial in /sys/class/tty/ttyUSB*; do break fi done - diff --git a/tools/py3_driver_progress.py b/tools/py3_driver_progress.py index 78714430..bd0f22a8 100644 --- a/tools/py3_driver_progress.py +++ b/tools/py3_driver_progress.py @@ -208,8 +208,7 @@ def main(): `NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses `MemoryMapBytes` exclusively internally. Whenever possible, all radios that are fixed for py3 should do so with this flag set to False and with - the byte-native memory map. - """), + the byte-native memory map."""), file=output) for driver, (tester, tested) in testers.items(): diff --git a/tools/serialsniff.c b/tools/serialsniff.c index 02037d7c..24544848 100644 --- a/tools/serialsniff.c +++ b/tools/serialsniff.c @@ -146,7 +146,7 @@ int saferead(int fd, char *buf, int len) if ((val.it_value.tv_sec == 0) && (val.it_value.tv_usec == 0)) { if (!quiescent) - printf("Timeout\n"); + printf("Timeout\n"); break; }