Skip to content

Commit 55aa885

Browse files
[py] moved ConnectionType class outside Mobile class to avoid nesting of classes (#12256)
[py] moved ConnectionType class outside Mobile class to avoid nesting in remote/mobile.py Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
1 parent 5a62db1 commit 55aa885

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

py/selenium/webdriver/remote/mobile.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,25 @@
1818
from .command import Command
1919

2020

21-
class Mobile:
22-
class ConnectionType:
23-
def __init__(self, mask):
24-
self.mask = mask
21+
class _ConnectionType:
22+
def __init__(self, mask):
23+
self.mask = mask
24+
25+
@property
26+
def airplane_mode(self):
27+
return self.mask % 2 == 1
2528

26-
@property
27-
def airplane_mode(self):
28-
return self.mask % 2 == 1
29+
@property
30+
def wifi(self):
31+
return (self.mask / 2) % 2 == 1
2932

30-
@property
31-
def wifi(self):
32-
return (self.mask / 2) % 2 == 1
33+
@property
34+
def data(self):
35+
return (self.mask / 4) > 0
3336

34-
@property
35-
def data(self):
36-
return (self.mask / 4) > 0
3737

38+
class Mobile:
39+
ConnectionType = _ConnectionType
3840
ALL_NETWORK = ConnectionType(6)
3941
WIFI_NETWORK = ConnectionType(2)
4042
DATA_NETWORK = ConnectionType(4)

0 commit comments

Comments
 (0)