Skip to content

Commit 2aa6e12

Browse files
authored
[CI] Reformat (#3347)
* Clean-up BUILD * Added pyproject.toml * Format gen * Fix * Fix format * Fix
1 parent ee42e1d commit 2aa6e12

13 files changed

Lines changed: 208 additions & 292 deletions

File tree

python/tflite_micro/BUILD

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ load(
1111
)
1212
load(
1313
"//tensorflow/lite/micro:build_def.bzl",
14+
"INCOMPATIBLE_WITH_WINDOWS",
1415
"tflm_cc_library",
1516
)
1617
load("//tools:expand_stamp_vars.bzl", "expand_stamp_vars")
@@ -91,10 +92,7 @@ py_test(
9192
"nomsan", # Python doesn't like these symbols in _runtime.so
9293
"noubsan",
9394
],
94-
target_compatible_with = select({
95-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
96-
"//conditions:default": [],
97-
}),
95+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
9896
deps = [
9997
":runtime",
10098
requirement("numpy"),
@@ -311,8 +309,5 @@ sh_test(
311309
"notap", # See http://b/294278650#comment4 for more details.
312310
"noubsan",
313311
],
314-
target_compatible_with = select({
315-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
316-
"//conditions:default": [],
317-
}),
312+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
318313
)

python/tflite_micro/signal/BUILD

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ load("@rules_python//python:defs.bzl", "py_library", "py_test")
33
load("@tflm_pip_deps//:requirements.bzl", "requirement")
44
load("//python/tflite_micro/signal:tflm_signal.bzl", "py_tflm_signal_library")
55
load("//tensorflow:extra_rules.bzl", "tflm_signal_friends")
6+
load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS")
67

78
package(
89
default_visibility = [":__subpackages__"],
@@ -14,14 +15,9 @@ package_group(
1415
packages = tflm_signal_friends(),
1516
)
1617

17-
TARGET_COMPATIBLE_WITH = select({
18-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
19-
"//conditions:default": [],
20-
})
21-
2218
cc_library(
2319
name = "ops_lib",
24-
target_compatible_with = TARGET_COMPATIBLE_WITH,
20+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
2521
visibility = [":signal_friends"],
2622
deps = [
2723
":delay_op_cc",
@@ -42,7 +38,7 @@ py_library(
4238
"__init__.py",
4339
"ops/__init__.py",
4440
],
45-
target_compatible_with = TARGET_COMPATIBLE_WITH,
41+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
4642
visibility = ["//visibility:public"],
4743
deps = [
4844
":delay_op",
@@ -78,7 +74,7 @@ py_test(
7874
"nomsan",
7975
"noubsan",
8076
],
81-
target_compatible_with = TARGET_COMPATIBLE_WITH,
77+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
8278
deps = [
8379
":delay_op",
8480
requirement("numpy"),
@@ -110,7 +106,7 @@ py_test(
110106
"nomsan",
111107
"noubsan",
112108
],
113-
target_compatible_with = TARGET_COMPATIBLE_WITH,
109+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
114110
deps = [
115111
":energy_op",
116112
requirement("numpy"),
@@ -142,7 +138,7 @@ py_test(
142138
"nomsan",
143139
"noubsan",
144140
],
145-
target_compatible_with = TARGET_COMPATIBLE_WITH,
141+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
146142
deps = [
147143
":fft_ops",
148144
requirement("numpy"),
@@ -180,7 +176,7 @@ py_test(
180176
"nomsan",
181177
"noubsan",
182178
],
183-
target_compatible_with = TARGET_COMPATIBLE_WITH,
179+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
184180
deps = [
185181
":filter_bank_ops",
186182
requirement("numpy"),
@@ -212,7 +208,7 @@ py_test(
212208
"nomsan",
213209
"noubsan",
214210
],
215-
target_compatible_with = TARGET_COMPATIBLE_WITH,
211+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
216212
deps = [
217213
":framer_op",
218214
requirement("numpy"),
@@ -241,7 +237,7 @@ py_test(
241237
"nomsan",
242238
"noubsan",
243239
],
244-
target_compatible_with = TARGET_COMPATIBLE_WITH,
240+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
245241
deps = [
246242
":overlap_add_op",
247243
requirement("absl_py"),
@@ -274,7 +270,7 @@ py_test(
274270
"nomsan",
275271
"noubsan",
276272
],
277-
target_compatible_with = TARGET_COMPATIBLE_WITH,
273+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
278274
deps = [
279275
":pcan_op",
280276
requirement("numpy"),
@@ -306,7 +302,7 @@ py_test(
306302
"nomsan",
307303
"noubsan",
308304
],
309-
target_compatible_with = TARGET_COMPATIBLE_WITH,
305+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
310306
deps = [
311307
":stacker_op",
312308
requirement("numpy"),
@@ -337,7 +333,7 @@ py_test(
337333
"nomsan",
338334
"noubsan",
339335
],
340-
target_compatible_with = TARGET_COMPATIBLE_WITH,
336+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
341337
deps = [
342338
":window_op",
343339
requirement("numpy"),

python/tflite_micro/signal/utils/BUILD

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
33
# Signal python utilities.
44
load("@rules_python//python:defs.bzl", "py_library", "py_test")
55
load("@tflm_pip_deps//:requirements.bzl", "requirement")
6+
load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS")
67

78
package(
89
default_visibility = [
@@ -11,11 +12,6 @@ package(
1112
licenses = ["notice"],
1213
)
1314

14-
TARGET_COMPATIBLE_WITH = select({
15-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
16-
"//conditions:default": [],
17-
})
18-
1915
py_test(
2016
name = "freq_to_mel_test",
2117
srcs = ["freq_to_mel_test.py"],
@@ -27,29 +23,29 @@ py_test(
2723
"nomsan",
2824
"noubsan",
2925
],
30-
target_compatible_with = TARGET_COMPATIBLE_WITH,
26+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
3127
)
3228

3329
py_library(
3430
name = "freq_to_mel",
3531
data = [
3632
":freq_to_mel_wrapper.so",
3733
],
38-
target_compatible_with = TARGET_COMPATIBLE_WITH,
34+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
3935
)
4036

4137
pybind_extension(
4238
name = "freq_to_mel_wrapper", # :freq_to_mel_wrapper.so
4339
srcs = [
4440
"freq_to_mel_wrapper.cc",
4541
],
46-
target_compatible_with = TARGET_COMPATIBLE_WITH,
42+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
4743
)
4844

4945
py_library(
5046
name = "util",
5147
srcs = ["util.py"],
52-
target_compatible_with = TARGET_COMPATIBLE_WITH,
48+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
5349
visibility = ["//visibility:public"],
5450
deps = [
5551
requirement("tensorflow"),
@@ -62,15 +58,15 @@ pybind_extension(
6258
srcs = [
6359
"wide_dynamic_func_lut_wrapper.cc",
6460
],
65-
target_compatible_with = TARGET_COMPATIBLE_WITH,
61+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
6662
)
6763

6864
py_library(
6965
name = "wide_dynamic_func_lut",
7066
data = [
7167
":wide_dynamic_func_lut_wrapper.so",
7268
],
73-
target_compatible_with = TARGET_COMPATIBLE_WITH,
69+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
7470
)
7571

7672
py_test(
@@ -84,6 +80,6 @@ py_test(
8480
"nomsan",
8581
"noubsan",
8682
],
87-
target_compatible_with = TARGET_COMPATIBLE_WITH,
83+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
8884
visibility = ["//visibility:public"],
8985
)

tensorflow/lite/micro/build_def.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
44
load("@rules_cc//cc:cc_library.bzl", "cc_library")
55
load("@rules_cc//cc:cc_test.bzl", "cc_test")
66

7+
INCOMPATIBLE_WITH_WINDOWS = select({
8+
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
9+
"//conditions:default": [],
10+
})
11+
712
def tflm_copts():
813
"""Returns the default copts for targets in TFLM.
914

tensorflow/lite/micro/compression/BUILD

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ load("@rules_shell//shell:sh_test.bzl", "sh_test")
88
load("@tflm_pip_deps//:requirements.bzl", "requirement")
99
load(
1010
"//tensorflow/lite/micro:build_def.bzl",
11+
"INCOMPATIBLE_WITH_WINDOWS",
1112
"tflm_cc_library",
1213
"tflm_cc_test",
1314
)
@@ -75,10 +76,7 @@ sh_test(
7576
"metadata_saved.h",
7677
":metadata_cc_srcs",
7778
],
78-
target_compatible_with = select({
79-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
80-
"//conditions:default": [],
81-
}),
79+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
8280
)
8381

8482
tflm_cc_test(
@@ -105,10 +103,7 @@ py_test(
105103
size = "small",
106104
srcs = ["metadata_test.py"],
107105
main = "metadata_test.py",
108-
target_compatible_with = select({
109-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
110-
"//conditions:default": [],
111-
}),
106+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
112107
deps = [
113108
"metadata_py",
114109
"@flatbuffers//:runtime_py",
@@ -154,10 +149,7 @@ py_test(
154149
"nomsan", # Sanitizer symbols don't work with Python extension libs
155150
"noubsan",
156151
],
157-
target_compatible_with = select({
158-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
159-
"//conditions:default": [],
160-
}),
152+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
161153
deps = [
162154
":compress",
163155
":metadata_py",
@@ -184,10 +176,7 @@ py_test(
184176
name = "model_facade_test",
185177
size = "small",
186178
srcs = ["model_facade_test.py"],
187-
target_compatible_with = select({
188-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
189-
"//conditions:default": [],
190-
}),
179+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
191180
deps = [
192181
":model_facade",
193182
":test_models",
@@ -207,10 +196,7 @@ py_test(
207196
name = "spec_test",
208197
size = "small",
209198
srcs = ["spec_test.py"],
210-
target_compatible_with = select({
211-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
212-
"//conditions:default": [],
213-
}),
199+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
214200
deps = [
215201
":spec",
216202
requirement("tensorflow"),
@@ -229,10 +215,7 @@ py_test(
229215
name = "spec_builder_test",
230216
size = "small",
231217
srcs = ["spec_builder_test.py"],
232-
target_compatible_with = select({
233-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
234-
"//conditions:default": [],
235-
}),
218+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
236219
deps = [
237220
":spec",
238221
":spec_builder",
@@ -254,10 +237,7 @@ py_test(
254237
name = "test_models_test",
255238
size = "small",
256239
srcs = ["test_models_test.py"],
257-
target_compatible_with = select({
258-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
259-
"//conditions:default": [],
260-
}),
240+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
261241
deps = [
262242
":test_models",
263243
"//tensorflow/lite/python:schema_py",
@@ -270,10 +250,7 @@ py_binary(
270250
srcs = [
271251
"view.py",
272252
],
273-
target_compatible_with = select({
274-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
275-
"//conditions:default": [],
276-
}),
253+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
277254
deps = [
278255
":metadata_py",
279256
"//tensorflow/lite/python:schema_py",

tensorflow/lite/micro/compression/view_tests.bzl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load("@rules_python//python:defs.bzl", "py_test")
22
load("@tflm_pip_deps//:requirements.bzl", "requirement")
3+
load("//tensorflow/lite/micro:build_def.bzl", "INCOMPATIBLE_WITH_WINDOWS")
34

45
def generate_view_tests(targets):
56
"""Generates py_test targets for each target's path and a test_suite to
@@ -19,10 +20,7 @@ def generate_view_tests(targets):
1920
args = ["$(location {})".format(target)],
2021
main = "view_test.py",
2122
data = [target],
22-
target_compatible_with = select({
23-
"@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"],
24-
"//conditions:default": [],
25-
}),
23+
target_compatible_with = INCOMPATIBLE_WITH_WINDOWS,
2624
deps = [
2725
":view",
2826
requirement("absl_py"),

0 commit comments

Comments
 (0)