Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some fixes for flake8 #672

Merged
merged 13 commits into from
Jun 27, 2023
Merged

Apply some fixes for flake8 #672

merged 13 commits into from
Jun 27, 2023

Conversation

dforsi
Copy link
Contributor

@dforsi dforsi commented Jun 22, 2023

This PR

  • removes some unused imports and variables (such as SETTINGS_LISTS and the e in except Exception as e:)
  • removes a couple of duplicate methods
  • fixes some escape sequences flagged as invalid (either by using raw strings of fixing the escape characters trying to be consistent with similar uses in other drivers)

and makes 16 files "clean".

@dforsi dforsi force-pushed the fix/flake8 branch 3 times, most recently from 35a364d to 5021ae7 Compare June 24, 2023 19:36
@@ -395,7 +395,7 @@ def format_freq(self):
def parse_freq(self, freqstr):
"""Set the frequency from a string"""
self.freq = parse_freq(freqstr)
return self.freqx
return self.freq
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! Not sure this ever got used, but better that it's right. Looks like an errant typo on my part :(

@@ -602,10 +602,6 @@ def set_settings(self, settings):
def process_mmap(self):
self.memobj = bitwise.parse(ICX90_MEM_FORMAT, self._mmap)

def get_raw_memory(self, number):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, this one is interesting... Maybe a bad merge at some point.

@kk7ds
Copy link
Owner

kk7ds commented Jun 26, 2023

This is a huge amount of work, thanks very much for doing this!

I'm fine with what is here, but I want to check with @KC9HI about the SETTING_LISTS things. Jim, you've added a lot of that. Were you just doing that for your own documentation or did those lists get used at some point somewhere? Perhaps just copy-and-paste stuff? They're not expected by any of the CHIRP infrastructure. Perhaps just a pattern that got copied from a driver that was using it?

@KC9HI
Copy link
Contributor

KC9HI commented Jun 27, 2023

Mainly copy-and-paste. Whoever developed the initial uv5r.py driver had a SETTING_LISTS thing and it just got migrated to other drivers. I don't remember if I ever asked what they were for. I just assumed it was a "CHIRP" thing. I don't use them for anything. If CHIRP doesn't need it, I don't need it and would be happy to stop adding/maintaining them.

@kk7ds
Copy link
Owner

kk7ds commented Jun 27, 2023

Okay, that might've been me, so I'll take the blame :)

I'll rebase this and merge then, thanks for the confirmation!

dforsi added 12 commits June 26, 2023 17:04
The function _() is installed in Python’s builtins namespace by
chirp/wxui/__init__.py
Fixes:
./chirp/drivers/lt725uv.py:269:9: F821 undefined name 'Log'
./chirp/drivers/vgc.py:354:9: F821 undefined name 'Log'
./chirp/drivers/ap510.py:407:19: F821 undefined name 'file'
./chirp/drivers/btech.py:811:62: F821 undefined name 'value'
./chirp/drivers/ic2730.py:1309:29: F821 undefined name 'sstx'
./chirp/drivers/thd72.py:839:9: F821 undefined name 'file'
./chirp/drivers/thd72.py:841:19: F821 undefined name 'file'
./chirp/drivers/tk760.py:229:19: F821 undefined name 'hexprint'
./chirp/drivers/retevis_rt98.py:591:17: F821 undefined name 'radio'
Fixes:
./chirp/drivers/kguv920pa.py:39:13: W605 invalid escape sequence '\]'
./chirp/drivers/retevis_rt87.py:199:47: W605 invalid escape sequence '\]'
./chirp/drivers/vx3.py:941:34: W605 invalid escape sequence '\d'
./chirp/drivers/ft90.py:674:34: W605 invalid escape sequence '\d'
./chirp/drivers/vx2.py:715:34: W605 invalid escape sequence '\d'
./chirp/drivers/ft1d.py:586:33: W605 invalid escape sequence '\d'
./chirp/drivers/ft1d.py:586:39: W605 invalid escape sequence '\s'
./chirp/drivers/ft1d.py:586:52: W605 invalid escape sequence '\d'
./chirp/drivers/vgc.py:1429:40: W605 invalid escape sequence '\d'
./chirp/drivers/vx8.py:525:33: W605 invalid escape sequence '\d'
./chirp/drivers/vx8.py:525:39: W605 invalid escape sequence '\s'
./chirp/drivers/vx8.py:525:52: W605 invalid escape sequence '\d'
./chirp/drivers/tk760g.py:88:71: W605 invalid escape sequence '\F'
./chirp/drivers/tk760g.py:277:59: W605 invalid escape sequence '\-'
./chirp/drivers/ic9x.py:51:30: W605 invalid escape sequence '\]'
./chirp/drivers/vx6.py:874:44: W605 invalid escape sequence '\d'
./chirp/drivers/vx6.py:887:37: W605 invalid escape sequence '\d'
./chirp/drivers/ap510.py:330:11: W605 invalid escape sequence '\#'
./chirp/drivers/ft7800.py:746:34: W605 invalid escape sequence '\d'
./chirp/drivers/retevis_rt26.py:885:40: W605 invalid escape sequence '\d'
Removed with:
autoflake --in-place --recursive --ignore-pass-after-docstring --remove-all-unused-imports .
and non committing the removal of "pass" statements.
Fixes:
F841 local variable 'e' is assigned to but never used
Fixes:
./chirp/drivers/retevis_rt98.py:25:1: F811 redefinition of unused 'RadioSettingValueString' from line 25
./chirp/drivers/th9000.py:25:1: F811 redefinition of unused 'RadioSettingValueString' from line 25
./chirp/drivers/icf.py:25:1: F811 redefinition of unused 'struct' from line 21
./chirp/drivers/icf.py:31:1: F811 redefinition of unused 'util' from line 27
Fixes:
./chirp/drivers/icx90.py:670:5: F811 redefinition of unused 'get_raw_memory' from line 605
./chirp/drivers/ft1d.py:2528:5: F811 redefinition of unused 'apply_WEhemi' from line 2521
For consistency with the set_settings() method in other drivers
Fixes:
chirp/chirp_common.py:398:15: E1101: Instance of 'Memory' has no 'freqx' member; maybe 'freq'? (no-member)
Fixes:
chirp/drivers/generic_csv.py:199:12: W0612: Unused variable 'header' (unused-variable)
This was probably lost in a rebase.
@kk7ds kk7ds merged commit d7b82e4 into kk7ds:master Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants