Skip to content

Commit

Permalink
[py] moved ConnectionType class outside Mobile class to avoid nes…
Browse files Browse the repository at this point in the history
…ting 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>
  • Loading branch information
sandeepsuryaprasad and diemol committed Jun 27, 2023
1 parent 5a62db1 commit 55aa885
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions py/selenium/webdriver/remote/mobile.py
Expand Up @@ -18,23 +18,25 @@
from .command import Command


class Mobile:
class ConnectionType:
def __init__(self, mask):
self.mask = mask
class _ConnectionType:
def __init__(self, mask):
self.mask = mask

@property
def airplane_mode(self):
return self.mask % 2 == 1

@property
def airplane_mode(self):
return self.mask % 2 == 1
@property
def wifi(self):
return (self.mask / 2) % 2 == 1

@property
def wifi(self):
return (self.mask / 2) % 2 == 1
@property
def data(self):
return (self.mask / 4) > 0

@property
def data(self):
return (self.mask / 4) > 0

class Mobile:
ConnectionType = _ConnectionType
ALL_NETWORK = ConnectionType(6)
WIFI_NETWORK = ConnectionType(2)
DATA_NETWORK = ConnectionType(4)
Expand Down

0 comments on commit 55aa885

Please sign in to comment.