Skip to content

Commit

Permalink
Add to flake8 in workflow and fix python files (#25280)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 5, 2024
1 parent 886e2d1 commit 5419829
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exclude = third_party
src/test_driver/openiotsdk/*
src/test_driver/mbed/*
src/test_driver/linux-cirque/*
src/test_driver/esp32/*
build/chip/java/tests/*
build/chip/linux/*
build/config/linux/*
Expand All @@ -25,7 +24,6 @@ exclude = third_party
scripts/build/builders/android.py
scripts/build/builders/bouffalolab.py
scripts/build/builders/cc13x2x7_26x2x7.py
scripts/build/builders/esp32.py
scripts/build/builders/genio.py
scripts/build/builders/gn.py
scripts/build/builders/imx.py
Expand Down Expand Up @@ -58,7 +56,6 @@ exclude = third_party
scripts/tests/chiptest/yamltest_with_chip_repl_tester.py
scripts/tools/check_zcl_file_sync.py
scripts/tools/convert_ini.py
scripts/tools/generate_esp32_chip_factory_bin.py
scripts/tools/memory/memdf/__init__.py
scripts/tools/memory/report_summary.py
scripts/tools/nrfconnect/generate_nrfconnect_chip_factory_data.py
Expand Down
5 changes: 3 additions & 2 deletions scripts/build/builders/esp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def IsCompatible(self, board: Esp32Board):
if board == Esp32Board.QEMU:
return self == Esp32App.TESTS
elif board == Esp32Board.M5Stack:
return self == Esp32App.ALL_CLUSTERS or self == Esp32App.ALL_CLUSTERS_MINIMAL or self == Esp32App.OTA_REQUESTOR or self == Esp32App.OTA_PROVIDER
return (self == Esp32App.ALL_CLUSTERS or self == Esp32App.ALL_CLUSTERS_MINIMAL or
self == Esp32App.OTA_REQUESTOR or self == Esp32App.OTA_PROVIDER)
elif board == Esp32Board.C3DevKit:
return self == Esp32App.ALL_CLUSTERS or self == Esp32App.ALL_CLUSTERS_MINIMAL
else:
Expand Down Expand Up @@ -244,5 +245,5 @@ def flashbundle(self):

with open(os.path.join(self.output_dir, self.app.FlashBundleName), 'r') as fp:
return {
l.strip(): os.path.join(self.output_dir, l.strip()) for l in fp.readlines() if l.strip()
line.strip(): os.path.join(self.output_dir, line.strip()) for line in fp.readlines() if line.strip()
}
10 changes: 5 additions & 5 deletions scripts/tools/generate_esp32_chip_factory_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import enum
import logging
import os
import shutil
import subprocess
import sys
from types import SimpleNamespace

Expand Down Expand Up @@ -198,7 +196,7 @@ def calendar_types_to_uint32(calendar_types):

def ishex(s):
try:
n = int(s, 16)
_ = int(s, 16)
return True
except ValueError:
return False
Expand Down Expand Up @@ -464,11 +462,13 @@ def any_base_int(s): return int(s, 0)
parser.add_argument('--mfg-date', help='Manufacturing date in format YYYY-MM-DD')
parser.add_argument('--serial-num', help='Serial number')
parser.add_argument('--rd-id-uid',
help='128-bit unique identifier for generating rotating device identifier, provide 32-byte hex string, e.g. "1234567890abcdef1234567890abcdef"')
help=('128-bit unique identifier for generating rotating device identifier, '
'provide 32-byte hex string, e.g. "1234567890abcdef1234567890abcdef"'))

# These will be used by DeviceInfoProvider
parser.add_argument('--calendar-types', nargs='+',
help='List of supported calendar types.\nSupported Calendar Types: Buddhist, Chinese, Coptic, Ethiopian, Gregorian, Hebrew, Indian, Islamic, Japanese, Korean, Persian, Taiwanese')
help=('List of supported calendar types.\nSupported Calendar Types: Buddhist, Chinese, Coptic, Ethiopian, '
'Gregorian, Hebrew, Indian, Islamic, Japanese, Korean, Persian, Taiwanese'))
parser.add_argument('--locales', nargs='+', help='List of supported locales, Language Tag as defined by BCP47, eg. en-US en-GB')
parser.add_argument('--fixed-labels', nargs='+',
help='List of fixed labels, eg: "0/orientation/up" "1/orientation/down" "2/orientation/down"')
Expand Down
3 changes: 1 addition & 2 deletions src/test_driver/esp32/run_qemu_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import os
import re
import subprocess
import sys

import click
import coloredlogs
Expand Down Expand Up @@ -147,7 +146,7 @@ def main(log_level, no_log_timestamps, image, file_image_list, qemu, verbose):
print("========== TEST OUTPUT END ============")

logging.info("Image %s PASSED", path)
except:
except Exception:
# make sure output is visible in stdout
print("========== TEST OUTPUT BEGIN ============")
print(output)
Expand Down

0 comments on commit 5419829

Please sign in to comment.