Skip to content

Commit c0ad626

Browse files
Ron Mordechaifacebook-github-bot
Ron Mordechai
authored andcommitted
Use new mypy-protobuf for all Python GRPC builds
Summary: The mypy-protobuf we use doesn't support proto3 optional fields. It's also really really outdated. The project has since been rewritten in Python. The previous diffs in the stack import it, this one moves the protobuf compiler to use the new version. Reviewed By: c-ryan747 Differential Revision: D58193786 fbshipit-source-id: e83ae25db2cc7d3ea99953d33dd44fde22cc792d
1 parent b7b807a commit c0ad626

File tree

7 files changed

+30
-11
lines changed

7 files changed

+30
-11
lines changed

idb/grpc/client.py

+15
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ async def approve(
527527
ApproveRequest(
528528
bundle_id=bundle_id,
529529
permissions=[APPROVE_MAP[permission] for permission in permissions],
530+
# pyre-ignore
530531
scheme=scheme,
531532
)
532533
)
@@ -542,6 +543,7 @@ async def revoke(
542543
RevokeRequest(
543544
bundle_id=bundle_id,
544545
permissions=[REVOKE_MAP[permission] for permission in permissions],
546+
# pyre-ignore
545547
scheme=scheme,
546548
)
547549
)
@@ -812,6 +814,7 @@ async def pull(
812814
src_path=src_path,
813815
# not sending the destination to remote companion
814816
# so it streams the file back
817+
# pyre-ignore
815818
dst_path=dest_path if self.is_local else None,
816819
container=file_container_to_grpc(container),
817820
)
@@ -1067,6 +1070,7 @@ async def record_video(self, stop: asyncio.Event, output_file: str) -> None:
10671070
else:
10681071
self.logger.info("Starting video recording with response data")
10691072
await stream.send_message(
1073+
# pyre-ignore
10701074
RecordRequest(start=RecordRequest.Start(file_path=None))
10711075
)
10721076
await stop.wait()
@@ -1102,6 +1106,7 @@ async def stream_video(
11021106
VideoStreamRequest(
11031107
start=VideoStreamRequest.Start(
11041108
file_path=output_file,
1109+
# pyre-ignore
11051110
fps=fps,
11061111
format=VIDEO_FORMAT_MAP[format],
11071112
compression_quality=compression_quality,
@@ -1114,7 +1119,9 @@ async def stream_video(
11141119
await stream.send_message(
11151120
VideoStreamRequest(
11161121
start=VideoStreamRequest.Start(
1122+
# pyre-ignore
11171123
file_path=None,
1124+
# pyre-ignore
11181125
fps=fps,
11191126
format=VIDEO_FORMAT_MAP[format],
11201127
compression_quality=compression_quality,
@@ -1315,6 +1322,7 @@ async def set_preference(
13151322
value=value,
13161323
name=name,
13171324
value_type=value_type,
1325+
# pyre-ignore
13181326
domain=domain,
13191327
)
13201328
)
@@ -1328,6 +1336,7 @@ async def get_locale(self) -> str:
13281336
@log_and_handle_exceptions("get_setting")
13291337
async def get_preference(self, name: str, domain: Optional[str]) -> str:
13301338
response = await self.stub.get_setting(
1339+
# pyre-ignore
13311340
GetSettingRequest(setting=AnySetting, name=name, domain=domain)
13321341
)
13331342
return response.value
@@ -1376,9 +1385,12 @@ async def xctrace_record(
13761385
else:
13771386
target = XctraceRecordRequest.Target(
13781387
launch_process=XctraceRecordRequest.LauchProcess(
1388+
# pyre-ignore
13791389
process_to_launch=process_to_launch,
13801390
launch_args=launch_args,
1391+
# pyre-ignore
13811392
target_stdin=target_stdin,
1393+
# pyre-ignore
13821394
target_stdout=target_stdout,
13831395
process_env=process_env,
13841396
)
@@ -1387,7 +1399,9 @@ async def xctrace_record(
13871399
XctraceRecordRequest(
13881400
start=XctraceRecordRequest.Start(
13891401
template_name=template_name,
1402+
# pyre-ignore
13901403
time_limit=time_limit,
1404+
# pyre-ignore
13911405
package=package,
13921406
target=target,
13931407
)
@@ -1406,6 +1420,7 @@ async def xctrace_record(
14061420
await stream.send_message(
14071421
XctraceRecordRequest(
14081422
stop=XctraceRecordRequest.Stop(
1423+
# pyre-ignore
14091424
timeout=stop_timeout,
14101425
args=post_args,
14111426
)

idb/grpc/crash.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919

2020
def _to_crash_log_info_list(response: CrashLogResponse) -> List[CrashLogInfo]:
21-
# pyre-fixme[16]: `RepeatedCompositeFieldContainer` has no attribute `__iter__`.
2221
return [_to_crash_log_info(proto) for proto in response.list]
2322

2423

@@ -40,8 +39,12 @@ def _to_crash_log(proto: CrashShowResponse) -> CrashLog:
4039

4140
def _to_crash_log_query_proto(query: CrashLogQuery) -> CrashLogQueryProto:
4241
return CrashLogQueryProto(
42+
# pyre-ignore
4343
before=query.before,
44+
# pyre-ignore
4445
since=query.since,
46+
# pyre-ignore
4547
bundle_id=query.bundle_id,
48+
# pyre-ignore
4649
name=query.name,
4750
)

idb/grpc/hid.py

+2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ def swipe_to_grpc(swipe: HIDSwipe) -> GrpcHIDSwipe:
102102
return GrpcHIDSwipe(
103103
start=point_to_grpc(swipe.start),
104104
end=point_to_grpc(swipe.end),
105+
# pyre-ignore
105106
delta=swipe.delta,
107+
# pyre-ignore
106108
duration=swipe.duration,
107109
)
108110

idb/grpc/instruments.py

+4
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ def translate_instruments_timings(
7171
) -> Optional[InstrumentsRunRequest.InstrumentsTimings]:
7272
return (
7373
InstrumentsRunRequest.InstrumentsTimings(
74+
# pyre-ignore
7475
terminate_timeout=timings.terminate_timeout,
76+
# pyre-ignore
7577
launch_retry_timeout=timings.launch_retry_timeout,
78+
# pyre-ignore
7679
launch_error_timeout=timings.launch_error_timeout,
80+
# pyre-ignore
7781
operation_duration=timings.operation_duration,
7882
)
7983
if timings

idb/grpc/target.py

+3
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ def screen_dimensions_to_grpc(dimensions: ScreenDimensions) -> GrpcScreenDimensi
5757
return GrpcScreenDimensions(
5858
width=dimensions.width,
5959
height=dimensions.height,
60+
# pyre-ignore
6061
density=dimensions.density,
62+
# pyre-ignore
6163
width_points=dimensions.width_points,
64+
# pyre-ignore
6265
height_points=dimensions.height_points,
6366
)
6467

idb/grpc/tests/hid_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_swipe(self) -> None:
6666
swipe=GrpcHIDSwipe(
6767
start=GrpcPoint(x=1, y=2),
6868
end=GrpcPoint(x=3, y=4),
69+
# pyre-ignore
6970
delta=delta,
7071
duration=0.5,
7172
)

idb/grpc/xctest.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def make_request(
125125
mode = Mode(
126126
ui=UI(
127127
app_bundle_id=app_bundle_id,
128+
# pyre-ignore
128129
test_host_app_bundle_id=test_host_app_bundle_id,
129130
)
130131
)
@@ -191,9 +192,6 @@ def make_results(
191192
],
192193
crashed=result.status == XctestRunResponse.TestRunInfo.CRASHED,
193194
)
194-
# pyre-fixme[16]: Item `RepeatedCompositeFieldContainer` of
195-
# `Union[RepeatedCompositeFieldContainer[], List[typing.Any]]` has no
196-
# attribute `__iter__`.
197195
for result in response.results or []
198196
]
199197

@@ -212,7 +210,6 @@ def make_failure_info(result: XctestRunResponse.TestRunInfo) -> TestRunFailureIn
212210
+ " "
213211
+ result.failure_info.failure_message
214212
)
215-
# pyre-fixme[16]: `RepeatedCompositeFieldContainer` has no attribute `__iter__`.
216213
for other_failure in result.other_failures:
217214
message = (
218215
message
@@ -247,16 +244,10 @@ def translate_activity(
247244
uniform_type_identifier=attachment.uniform_type_identifier,
248245
user_info_json=attachment.user_info_json,
249246
)
250-
# pyre-fixme[16]: Item `RepeatedCompositeFieldContainer` of
251-
# `Union[RepeatedCompositeFieldContainer[], List[typing.Any]]` has no
252-
# attribute `__iter__`.
253247
for attachment in activity.attachments or []
254248
],
255249
sub_activities=[
256250
translate_activity(sub_activity)
257-
# pyre-fixme[16]: Item `RepeatedCompositeFieldContainer` of
258-
# `Union[RepeatedCompositeFieldContainer[], List[typing.Any]]` has no
259-
# attribute `__iter__`.
260251
for sub_activity in activity.sub_activities or []
261252
],
262253
)

0 commit comments

Comments
 (0)