Skip to content

Commit

Permalink
pylint'ing
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpete committed Sep 9, 2022
1 parent 587f5e7 commit 2530c3d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
20 changes: 20 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@



[MASTER]
ignore=flipperzero_protobuf_compiled

[FORMAT]
max-line-length=110
max-module-lines=2000

[MESSAGES CONTROL]
disable=invalid-name,missing-docstring

[DESIGN]
max-branches=30
max-attributes=15
max-locals=30
max-public-methods=30
max-statements=90

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ FILES=ir_gen_all_codes.py ir_plot.py \

all: pylint

lint: pylint

pylint:
for targ in ${FILES} ; do \
echo $$targ ; \
Expand All @@ -29,6 +31,7 @@ pylint:

# pylint --load-plugins perflint $$targ ; \
# python -m py_compile $$targ ; \
#


pep8: pycodestyle
Expand Down
2 changes: 1 addition & 1 deletion subghz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A Collection of Signal Files

#### [fan_bruteforce](fan_bruteforce) ####

Brute Force IR code for Harbor Breeze Fan Remote Control
Brute Force RF code for Harbor Breeze Fan Remote Control
Model FAN-11T FAN-35T FAN-53T

Amazon product link: [Harbor Breeze Fan Remote Control](https://www.amazon.com/Ceiling-Control-Replacement-Hampton-KUJCE9103/)
Expand Down
22 changes: 13 additions & 9 deletions subghz_decode_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def set_maxpower(self, power=None, invert=False):
else:
power= 0xC0

self.set_power(self, power, invert)
self.set_power(power, invert)

def set_power(self, power=None, invert=False):
mod = self.get_Modulation()
Expand Down Expand Up @@ -502,7 +502,7 @@ def set_PktDataWhitening(self, enable=True):
dwEnable = (0,1)[enable]<<6
pktctrl0 = self.reg_list[self.PKTCTRL0]

pktctrl0 &= ~0x40 # PKTCTRL0_WHITE_DATA
pktctrl0 &= ~0x40 # PKTCTRL0_WHITE_DATA
pktctrl0 |= dwEnable
self.reg_list[self.PKTCTRL0] = pktctrl0

Expand Down Expand Up @@ -566,10 +566,12 @@ def set_Enable_CRC(self, enable=True):

def set_Pktlen_conf(self, pconf=2, maxlen=RF_MAX_TX_BLOCK):

if isinstance(mod, str):
if mod not in self.PKT_LENGTH_CONF:
# pconf cnan be the conf val or name string
if isinstance(pconf, str):
sval = pconf.capitalize() # capitalize first chat
if sval not in self.PKT_LENGTH_CONF:
raise ValueError(f"Unknown Length Conf: {pconf}")
pconf = self.PKT_LENGTH_CONF[pconf]
pconf = self.PKT_LENGTH_CONF[sval]

pconf &= 0x03

Expand Down Expand Up @@ -717,15 +719,17 @@ def get_NumPreamble(self):
if self.reg_list[self.MDMCFG1] is None:
return None


preamble = (self.reg_list[self.MDMCFG1] & MFMCFG1_NUM_PREAMBLE) >> 4
return self.num_preamble[preamble]

def set_NumPreamble(self, preamble=MFMCFG1_NUM_PREAMBLE_4):
print("set_NumPreamble {preamble}")
if self._debug:
print("set_NumPreamble {preamble}")

if preamble not in self.num_preamble_map:
vals = ' '.join(map(str, self.num_preamble))
raise ValueError("NumPreamble must have value of {vals}")
# pylint: disable=consider-using-f-string
raise ValueError("NumPreamble must have value of {}".format(
' '.join(map(str, self.num_preamble))))

preamble = self.num_preamble_map[preamble]

Expand Down
2 changes: 1 addition & 1 deletion subghz_gen_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def hex2bin(s):
# if (sl % 2):
# s += '0'
for i in range(0, sl, 1):
b = "{:04b}".format(int(s[i], 16))
b = "{:04b}".format(int(s[i], 16)) # pylint: disable=consider-using-f-string
# print(s[i], b)
r.append(b)
return ''.join(r)
Expand Down

0 comments on commit 2530c3d

Please sign in to comment.