Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2c5f7ca

Browse files
fpistmmassonal
authored andcommitted
fix: error and warning raised by flake8
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>Signed-off-by: Alexis Masson <alexis.masson@st.com>
1 parenta7c315d commit2c5f7ca

12 files changed

+46
-22
lines changed

‎cmake/scripts/.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88

‎cmake/scripts/ccwrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
shargs=parser.parse_args()
2424

25-
logline=re.compile("^\.* .+$")# a series of dots, a space, a filename
25+
logline=re.compile(r"^\.* .+$")# a series of dots, a space, a filename
2626

2727

2828
proc=subprocess.run(shargs.cmd,capture_output=True,encoding="ascii")

‎cmake/scripts/cmake_core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env python3
22

33
importargparse
4-
importsys
54
frompathlibimportPath
65
fromjinja2importEnvironment,FileSystemLoader
7-
fromcmake_genimport*
6+
fromcmake_genimportconfig_for_bareflat,render
87

98
script_path=Path(__file__).parent.resolve()
109

‎cmake/scripts/cmake_easy_setup.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
print(
4747
"""
4848
Warning: you did not specify which board you were targeting;
49-
please review the generated CMakeLists.txt to remove the placeholder value before calling `cmake`.
49+
please review the generated CMakeLists.txt to remove the placeholder
50+
value before calling `cmake`.
5051
"""
5152
)
5253

@@ -121,8 +122,20 @@ def get_boards(boardstxt):
121122
libpaths[line["location"]]=pathlib.Path(line["dir"])
122123

123124
# platform lib path is already known, obviously, since that's where this script resides
124-
userlibs=pathlib.Path(libpaths["user"]).resolve()
125-
libs= [u.nameforuinuserlibs.iterdir()ifu.is_dir()]
125+
userlibs=pathlib.Path(libpaths["user"])
126+
ifuserlibs.exists():
127+
userlibs=userlibs.resolve()
128+
libs= [u.nameforuinuserlibs.iterdir()ifu.is_dir()]
129+
else:
130+
print(
131+
f"""Warning: Cannot find{userlibs}.
132+
This has likely to do with your arduino-cli configuration.
133+
Please refer to the following link for setup details:
134+
https://arduino.github.io/arduino-cli/0.26/getting-started/#create-a-configuration-file
135+
"""
136+
)
137+
libs=list()
138+
126139
corepath=pathlib.Path(__file__).parent.parent.parent.resolve()
127140

128141
j2_env=Environment(

‎cmake/scripts/cmake_libs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
importargparse
44
frompathlibimportPath
55
fromjinja2importEnvironment,FileSystemLoader
6-
fromcmake_genimport*
6+
fromcmake_genimportautoconfig,render
77

88
script_path=Path(__file__).parent.resolve()
99

‎cmake/scripts/cmake_updater_hook.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env python3
22

33
"""
4-
This file centralizes all the operations needed to regenerate the CMakeLists.txt scattered along this repo.
4+
This file centralizes all the operations needed to regenerate the CMakeLists.txt
5+
scattered along this repo.
56
Hint: it would be a good practice to run it before committing...
67
"""
78

‎cmake/scripts/cmake_variant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
importargparse
44
frompathlibimportPath
55
fromjinja2importEnvironment,FileSystemLoader
6-
fromcmake_genimport*
6+
fromcmake_genimportconfig_for_bareflat,render
77

88
script_path=Path(__file__).parent.resolve()
99

‎cmake/scripts/generate_header.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
importargparse
44
importpathlib
5-
importsubprocess
65

76
parser=argparse.ArgumentParser()
87
parser.add_argument(

‎cmake/scripts/parse_boards.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __getattr__(self, attr):
2525
returnself.__getitem__(attr)
2626

2727
def__setattr__(self,attr,val):
28-
returnself.__setitem__(item,attr)
28+
returnself.__setitem__(val,attr)
2929

3030
defset_default_entries(self,mothercfg):
3131
fork,vinmothercfg.items():
@@ -51,9 +51,13 @@ def evaluate_entries(self, wrt=None):
5151
self[k].evaluate_entries(wrt)
5252

5353

54+
defdefault_reject(x):
55+
returnFalse
56+
57+
5458
defparse_file(infile,reject=None):
5559
ifrejectisNone:
56-
reject=lambdax:False
60+
reject=default_reject
5761

5862
config=Configuration()
5963

‎cmake/scripts/sizereport.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@
4949

5050
print(
5151
f"""
52-
Sketch uses{allsz} bytes ({allsz/shargs.progmem:.0%}) of program storage space. Maximum is{shargs.progmem} bytes.
53-
Global variables use{datasz} bytes ({datasz/shargs.datamem:.0%}) of dynamic memory, leaving{shargs.datamem-datasz} bytes for local variables. Maximum is{shargs.datamem} bytes.
52+
Sketch uses{allsz} bytes ({allsz/shargs.progmem:.0%}) of program storage space.\
53+
Maximum is{shargs.progmem} bytes.
54+
Global variables use{datasz} bytes ({datasz/shargs.datamem:.0%}) of dynamic memory,\
55+
leaving{shargs.datamem-datasz} bytes for local variables.\
56+
Maximum is{shargs.datamem} bytes.
5457
"""
5558
)

‎cmake/scripts/syms.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ def parse_file(mapf):
4343
demander,sym=line.strip().rsplit(") (",1)
4444
demander=demander+")"
4545
sym="("+sym
46-
except:
46+
exceptException:
4747
continue
4848
else:
4949
provider=line.strip()
5050

5151
ifprovideranddemanderandsym:
52-
objdemander=demander.rsplit("/",1)[
53-
1
54-
]# .split("(")[0] gets the lib ; without this you get the obj
52+
# .split("(")[0] gets the lib ; without this you get the obj
53+
objdemander=demander.rsplit("/",1)[1]
5554
objprovider=provider.rsplit("/",1)[1]
5655
libdemander=objdemander.split("(")[0]
5756
libprovider=objprovider.split("(")[0]

‎cmake/scripts/update_boarddb.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ def get_fpconf(config):
1616

1717
defboardstxt_filter(key):
1818
# Remove menu entry labels
19-
# In our data model, they conflict with the actual configuration they are associated to
20-
# i.e. Nucleo_144.menu.pnum.NUCLEO_F207ZG would be both a string ("Nucleo F207ZG")
19+
# In our data model, they conflict with the actual configuration
20+
# they are associated to
21+
# i.e. Nucleo_144.menu.pnum.NUCLEO_F207ZG would be both
22+
# a string ("Nucleo F207ZG")
2123
# and a dict (.build.variant_h=..., .upload.maximum_size=...)
2224

2325
ifkey[0]=="menu":
@@ -120,7 +122,8 @@ def regenerate_template(config, infile, outfile):
120122
famcfg.set_default_entries(platformtxt_cfg)
121123

122124
inherit_fam=famcfg.copy()
123-
# shallow copy; we don't want to impact famcfg so we have to copy before edit/del
125+
# shallow copy;
126+
# we don't want to impact famcfg so we have to copy before edit/del
124127
inherit_fam["menu"]=inherit_fam["menu"].copy()
125128
# del what you iterate over (otherwise you get infinite nesting)
126129
delinherit_fam["menu"]["pnum"]
@@ -142,7 +145,8 @@ def regenerate_template(config, infile, outfile):
142145
labelcfg.set_default_entries(inherit_board)
143146
labelcfg.evaluate_entries()
144147

145-
# base config won't manage all the board features, we thus have to mask them out
148+
# base config won't manage all the board features,
149+
# we thus have to mask them out
146150
forfeatinBOARD_FEATURES:
147151
boardcfg.build[feat]=""
148152

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp