lamda 7.80__tar.gz → 7.85__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {lamda-7.80 → lamda-7.85}/PKG-INFO +1 -1
- {lamda-7.80 → lamda-7.85}/lamda/__init__.py +1 -1
- {lamda-7.80 → lamda-7.85}/lamda/client.py +89 -6
- {lamda-7.80 → lamda-7.85}/lamda.egg-info/PKG-INFO +1 -1
- {lamda-7.80 → lamda-7.85}/README.md +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/bcast.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/const.py +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/exceptions.py +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/any.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/api.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/compiler/plugin.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/descriptor.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/duration.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/empty.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/field_mask.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/source_context.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/struct.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/timestamp.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/type.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/google/protobuf/wrappers.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/application.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/debug.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/file.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/policy.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/proxy.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/services.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/settings.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/shell.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/status.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/storage.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/types.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/uiautomator.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/util.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/rpc/wifi.proto +0 -0
- {lamda-7.80 → lamda-7.85}/lamda/types.py +0 -0
- {lamda-7.80 → lamda-7.85}/lamda.egg-info/SOURCES.txt +0 -0
- {lamda-7.80 → lamda-7.85}/lamda.egg-info/dependency_links.txt +0 -0
- {lamda-7.80 → lamda-7.85}/lamda.egg-info/not-zip-safe +0 -0
- {lamda-7.80 → lamda-7.85}/lamda.egg-info/requires.txt +0 -0
- {lamda-7.80 → lamda-7.85}/lamda.egg-info/top_level.txt +0 -0
- {lamda-7.80 → lamda-7.85}/setup.cfg +0 -0
- {lamda-7.80 → lamda-7.85}/setup.py +0 -0
@@ -57,6 +57,8 @@ logger.addHandler(handler)
|
|
57
57
|
|
58
58
|
sys.path.append(joinpath(dirname(__file__)))
|
59
59
|
sys.path.append(joinpath(dirname(__file__), "rpc"))
|
60
|
+
# use native resolver to support mDNS
|
61
|
+
os.environ["GRPC_DNS_RESOLVER"] = "native"
|
60
62
|
|
61
63
|
protos, services = grpc.protos_and_services("services.proto")
|
62
64
|
__all__ = [
|
@@ -179,6 +181,8 @@ def contain(a, b):
|
|
179
181
|
b.right <= a.right])
|
180
182
|
|
181
183
|
def equal(a, b):
|
184
|
+
if not isinstance(b, protos.Bound):
|
185
|
+
return False
|
182
186
|
return all([b.top == a.top,
|
183
187
|
b.left == a.left,
|
184
188
|
b.bottom == a.bottom,
|
@@ -194,6 +198,8 @@ Corner = protos.Corner
|
|
194
198
|
Direction = protos.Direction
|
195
199
|
GproxyType = protos.GproxyType
|
196
200
|
GrantType = protos.GrantType
|
201
|
+
ScriptRuntime = protos.ScriptRuntime
|
202
|
+
DataEncode = protos.DataEncode
|
197
203
|
|
198
204
|
Group = protos.Group
|
199
205
|
Key = protos.Key
|
@@ -256,8 +262,6 @@ TouchSequence.appendUp = touchSequenceAppendUp
|
|
256
262
|
TouchSequence.__getitem__ = touchSequenceIndexer
|
257
263
|
TouchSequence.__iter__ = touchSequenceIter
|
258
264
|
|
259
|
-
DataEncode = protos.DataEncode
|
260
|
-
ScriptRuntime = protos.ScriptRuntime
|
261
265
|
HookRpcRequest = protos.HookRpcRequest
|
262
266
|
HookRpcResponse = protos.HookRpcResponse
|
263
267
|
|
@@ -385,13 +389,14 @@ class GrpcRemoteExceptionInterceptor(ClientInterceptor):
|
|
385
389
|
|
386
390
|
|
387
391
|
class ObjectUiAutomatorOpStub:
|
388
|
-
def __init__(self,
|
392
|
+
def __init__(self, caller, selector):
|
389
393
|
"""
|
390
394
|
UiAutomator 子接口,用来模拟出实例的意味
|
391
395
|
"""
|
392
396
|
self._selector = selector
|
393
397
|
self.selector = Selector(**selector)
|
394
|
-
self.stub = stub
|
398
|
+
self.stub = caller.stub
|
399
|
+
self.caller = caller
|
395
400
|
def __str__(self):
|
396
401
|
selector = ", ".join(["{}={}".format(k, v) \
|
397
402
|
for k, v in self._selector.items()])
|
@@ -494,6 +499,72 @@ class ObjectUiAutomatorOpStub:
|
|
494
499
|
req = protos.SelectorOnlyRequest(selector=self.selector)
|
495
500
|
r = self.stub.selectorObjInfoOfAllInstances(req)
|
496
501
|
return r.objects
|
502
|
+
def all_instances(self):
|
503
|
+
"""
|
504
|
+
获取选择器选中的所有元素控件
|
505
|
+
"""
|
506
|
+
return list(self)
|
507
|
+
def _new_object(self, **kwargs):
|
508
|
+
selector = copy.deepcopy(self._selector)
|
509
|
+
selector.update(**kwargs)
|
510
|
+
instance = self.caller(**selector)
|
511
|
+
return instance
|
512
|
+
def text(self, txt):
|
513
|
+
return self._new_object(text=txt)
|
514
|
+
def resourceId(self, name):
|
515
|
+
return self._new_object(resourceId=name)
|
516
|
+
def description(self, desc):
|
517
|
+
return self._new_object(description=desc)
|
518
|
+
def packageName(self, name):
|
519
|
+
return self._new_object(packageName=name)
|
520
|
+
def className(self, name):
|
521
|
+
return self._new_object(className=name)
|
522
|
+
def textContains(self, needle):
|
523
|
+
return self._new_object(textContains=needle)
|
524
|
+
def descriptionContains(self, needle):
|
525
|
+
return self._new_object(descriptionContains=needle)
|
526
|
+
def textStartsWith(self, needle):
|
527
|
+
return self._new_object(textStartsWith=needle)
|
528
|
+
def descriptionStartsWith(self, needle):
|
529
|
+
return self._new_object(descriptionStartsWith=needle)
|
530
|
+
def textMatches(self, match):
|
531
|
+
return self._new_object(textMatches=match)
|
532
|
+
def descriptionMatches(self, match):
|
533
|
+
return self._new_object(descriptionMatches=match)
|
534
|
+
def resourceIdMatches(self, match):
|
535
|
+
return self._new_object(resourceIdMatches=match)
|
536
|
+
def packageNameMatches(self, match):
|
537
|
+
return self._new_object(packageNameMatches=match)
|
538
|
+
def classNameMatches(self, match):
|
539
|
+
return self._new_object(classNameMatches=match)
|
540
|
+
def checkable(self, value):
|
541
|
+
return self._new_object(checkable=value)
|
542
|
+
def clickable(self, value):
|
543
|
+
return self._new_object(clickable=value)
|
544
|
+
def focusable(self, value):
|
545
|
+
return self._new_object(focusable=value)
|
546
|
+
def scrollable(self, value):
|
547
|
+
return self._new_object(scrollable=value)
|
548
|
+
def longClickable(self, value):
|
549
|
+
return self._new_object(longClickable=value)
|
550
|
+
def enabled(self, value):
|
551
|
+
return self._new_object(enabled=value)
|
552
|
+
def checked(self, value):
|
553
|
+
return self._new_object(checked=value)
|
554
|
+
def focused(self, value):
|
555
|
+
return self._new_object(focused=value)
|
556
|
+
def selected(self, value):
|
557
|
+
return self._new_object(selected=value)
|
558
|
+
def index(self, idx):
|
559
|
+
return self._new_object(index=idx)
|
560
|
+
def instance(self, idx):
|
561
|
+
return self._new_object(instance=idx)
|
562
|
+
def __iter__(self):
|
563
|
+
"""
|
564
|
+
遍历所有符合选择器条件的元素实例
|
565
|
+
"""
|
566
|
+
yield from [self.instance(i) for i in \
|
567
|
+
range(self.count())]
|
497
568
|
def count(self):
|
498
569
|
"""
|
499
570
|
获取选择器选中控件的数量
|
@@ -962,7 +1033,7 @@ class UiAutomatorStub(BaseServiceStub):
|
|
962
1033
|
r = self.stub.waitForIdle(protos.Integer(value=timeout))
|
963
1034
|
return r.value
|
964
1035
|
def __call__(self, **kwargs):
|
965
|
-
return ObjectUiAutomatorOpStub(self
|
1036
|
+
return ObjectUiAutomatorOpStub(self, kwargs)
|
966
1037
|
|
967
1038
|
|
968
1039
|
class AppScriptRpcInterface(object):
|
@@ -2042,6 +2113,14 @@ class Device(object):
|
|
2042
2113
|
session=None):
|
2043
2114
|
self.certificate = certificate
|
2044
2115
|
self.server = "{0}:{1}".format(host, port)
|
2116
|
+
policy = dict()
|
2117
|
+
policy["maxAttempts"] = 5
|
2118
|
+
policy["retryableStatusCodes"] = ["UNAVAILABLE"]
|
2119
|
+
policy["backoffMultiplier"] = 2
|
2120
|
+
policy["initialBackoff"] = "0.5s"
|
2121
|
+
policy["maxBackoff"] = "15s"
|
2122
|
+
config = json.dumps(dict(methodConfig=[{"name": [{}],
|
2123
|
+
"retryPolicy": policy,}]))
|
2045
2124
|
if certificate is not None:
|
2046
2125
|
with open(certificate, "rb") as fd:
|
2047
2126
|
key, crt, ca = self._parse_certdata(fd.read())
|
@@ -2051,10 +2130,14 @@ class Device(object):
|
|
2051
2130
|
self._chan = grpc.secure_channel(self.server, creds,
|
2052
2131
|
options=(("grpc.ssl_target_name_override",
|
2053
2132
|
self._parse_cname(crt)),
|
2133
|
+
("grpc.service_config", config),
|
2054
2134
|
("grpc.enable_http_proxy",
|
2055
2135
|
0)))
|
2056
2136
|
else:
|
2057
|
-
self._chan = grpc.insecure_channel(self.server
|
2137
|
+
self._chan = grpc.insecure_channel(self.server,
|
2138
|
+
options=(("grpc.service_config", config),
|
2139
|
+
("grpc.enable_http_proxy", 0))
|
2140
|
+
)
|
2058
2141
|
session = session or uuid.uuid4().hex
|
2059
2142
|
interceptors = [ClientSessionMetadataInterceptor(session),
|
2060
2143
|
GrpcRemoteExceptionInterceptor(),
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|