Skip to content

Commit c531b43

Browse files
Merge branch 'master' into commodity_tariff_replace_std_collections
2 parents 57eb32b + 1992150 commit c531b43

File tree

106 files changed

+349
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+349
-347
lines changed

config/common/cmake/make_gn_args.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ def write_gn_args(args):
5656
filtered_value = filter(lambda v: v != "D", filtered_value)
5757
filtered_value = filter(lambda v: v != "isystem", filtered_value)
5858
# Escaped quote and dollar sign characters
59-
filtered_value = map(lambda v: v.replace('"', '\\"'), filtered_value)
60-
filtered_value = map(lambda v: v.replace('$', '\\$'), filtered_value)
59+
filtered_value = (v.replace('"', '\\"') for v in filtered_value)
60+
filtered_value = (v.replace('$', '\\$') for v in filtered_value)
6161
# Remove white spaces around the argument and remove internal whitespace
6262
# for correct splitting in string_split() function
63-
filtered_value = map(lambda v: v.strip(), filtered_value)
64-
filtered_value = map(lambda v: v.replace(' ', ''), filtered_value)
63+
filtered_value = (v.strip() for v in filtered_value)
64+
filtered_value = (v.replace(' ', '') for v in filtered_value)
6565
# Remove duplicates
6666
filtered_value = list(dict.fromkeys(filtered_value))
6767

config/esp32/components/chip/create_args_gn.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@
4444
compile_commands = json.load(compile_commands_json)
4545

4646
def get_compile_flags(src_file):
47-
compile_command = list(map(lambda res: res["command"],
48-
filter(lambda cmd: cmd["file"] == src_file, compile_commands)))
47+
compile_command = [
48+
res["command"]
49+
for res in filter(lambda cmd: cmd["file"] == src_file, compile_commands)
50+
]
4951

5052
if len(compile_command) != 1:
51-
raise Exception("Failed to resolve compile flags for %s", src_file)
53+
raise Exception(f"Failed to resolve compile flags for {src_file}")
5254

5355
compile_command = compile_command[0]
5456
# Trim compiler, input and output
@@ -57,12 +59,10 @@ def get_compile_flags(src_file):
5759
replace = "-I%s" % args.idf_path
5860
replace_with = "-isystem%s" % args.idf_path
5961

60-
compile_flags = list(map(lambda f: ('"%s"' % f).replace(
61-
replace, replace_with), compile_flags))
62+
compile_flags = [f'"{f}"'.replace(replace, replace_with) for f in compile_flags]
6263

6364
if args.filter_out:
64-
filter_out = list(map(lambda f: ('"%s"' % f),
65-
args.filter_out.split(';')))
65+
filter_out = [f'"{f}"' for f in args.filter_out.split(';')]
6666
compile_flags = [c for c in compile_flags if c not in filter_out]
6767

6868
return compile_flags

credentials/generate_revocation_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
__LOG_LEVELS__ = {
4747
'debug': logging.DEBUG,
4848
'info': logging.INFO,
49-
'warn': logging.WARN,
49+
'warn': logging.WARNING,
5050
'fatal': logging.FATAL,
5151
}
5252

docs/_extensions/external_content.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ def sync_contents(app: Sphinx) -> None:
169169

170170
srcdir = Path(app.srcdir).resolve()
171171
to_copy = []
172-
to_delete = set(f for f in srcdir.glob("**/*") if not f.is_dir())
173-
to_keep = set(
172+
to_delete = {f for f in srcdir.glob("**/*") if not f.is_dir()}
173+
to_keep = {
174174
f
175175
for k in app.config.external_content_keep
176176
for f in srcdir.glob(k)
177177
if not f.is_dir()
178-
)
178+
}
179179

180180
for content in app.config.external_content_contents:
181181
prefix_src, glob = content

examples/chef/chef.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ def splash() -> None:
6969

7070

7171
def load_config() -> None:
72-
config = dict()
73-
config["nrfconnect"] = dict()
74-
config["esp32"] = dict()
75-
config["silabs-thread"] = dict()
76-
config["ameba"] = dict()
77-
config["telink"] = dict()
72+
config = {}
73+
config["nrfconnect"] = {}
74+
config["esp32"] = {}
75+
config["silabs-thread"] = {}
76+
config["ameba"] = {}
77+
config["telink"] = {}
7878
configFile = f"{_CHEF_SCRIPT_PATH}/config.yaml"
7979
if (os.path.exists(configFile)):
8080
configStream = open(configFile, 'r')

examples/common/pigweed/rpc_console/py/chip_rpc/plugins/helper_scripts.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,23 @@ def get_descriptor(self) -> str:
3636
if not status.ok():
3737
raise Exception("Failed to read ep0 device type list: %s", status)
3838

39-
out["device_types"] = list(
40-
map(lambda dt: dt.device_type, device_types))
39+
out["device_types"] = [dt.device_type for dt in device_types]
4140
(status, parts_list) = self.rpcs.chip.rpc.Descriptor.PartsList(endpoint=0)
4241
if not status.ok():
4342
raise Exception("Failed to read ep0 parts list: %s", status)
4443

45-
out["parts_list"] = list(map(lambda ep: ep.endpoint, parts_list))
44+
out["parts_list"] = [ep.endpoint for ep in parts_list]
4645
out["endpoints"] = {}
4746
for ep in out["parts_list"]:
4847
out["endpoints"][str(ep)] = {}
4948
(status, clusters) = self.rpcs.chip.rpc.Descriptor.ClientList(endpoint=ep)
5049
if not status.ok():
5150
raise Exception("Failed to read ep0 parts list: %s", status)
52-
out["endpoints"][str(ep)]["client_list"] = list(
53-
map(lambda c: c.cluster_id, clusters))
51+
out["endpoints"][str(ep)]["client_list"] = [c.cluster_id for c in clusters]
5452
(status, clusters) = self.rpcs.chip.rpc.Descriptor.ServerList(endpoint=ep)
5553
if not status.ok():
5654
raise Exception("Failed to read ep0 parts list: %s", status)
57-
out["endpoints"][str(ep)]["server_list"] = list(
58-
map(lambda c: c.cluster_id, clusters))
55+
out["endpoints"][str(ep)]["server_list"] = [c.cluster_id for c in clusters]
5956

6057
return out
6158

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,18 @@ select = [
2727
"E", "W", "F",
2828
# Consistent commas
2929
"COM",
30+
# Simplify the code if possible
31+
"C4",
3032
# Ensure that scripts are executable
3133
"EXE",
34+
# Check for common logging issues
35+
"LOG",
3236
# Check for common optimization issues
3337
"SLOT",
3438
]
3539
ignore = [
36-
"COM812", # Do not enforce trailing commas in multi-line collections
40+
"COM812", # Do not enforce trailing commas in multi-line collections for now
41+
"LOG015", # Do not enforce non-root loggers in the entire codebase for now
3742
"E501", # Do not report line length issues (formatter should handle this)
3843
"E721", # We use it for good reasons
3944
]

scripts/checkout_submodules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
CHIP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
2626

27-
ALL_PLATFORMS = set([
27+
ALL_PLATFORMS = {
2828
'ameba',
2929
'android',
3030
'asr',
@@ -50,7 +50,7 @@
5050
'genio',
5151
'silabs_docker',
5252
'unit_tests'
53-
])
53+
}
5454

5555
Module = namedtuple('Module', 'name path platforms recursive')
5656

scripts/codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def write_new_data(self, relative_path: str, content: str):
6262
__LOG_LEVELS__ = {
6363
'debug': logging.DEBUG,
6464
'info': logging.INFO,
65-
'warn': logging.WARN,
65+
'warn': logging.WARNING,
6666
'fatal': logging.FATAL,
6767
}
6868

scripts/codegen_paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
__LOG_LEVELS__ = {
3737
'debug': logging.DEBUG,
3838
'info': logging.INFO,
39-
'warn': logging.WARN,
39+
'warn': logging.WARNING,
4040
'fatal': logging.FATAL,
4141
}
4242

0 commit comments

Comments
 (0)