Skip to content

Commit

Permalink
Fix linting issues (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
timvlaer committed Jul 19, 2024
1 parent 1684f36 commit 1cbe6e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions examples/initial_setup_e5576-320.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

parser = ArgumentParser()
parser.add_argument('--password', type=str)
parser.add_argument('--new-password', type=str)
parser.add_argument('--newpassword', type=str)
parser.add_argument('--ssid', type=str)
parser.add_argument('--wpa-password', type=str)
parser.add_argument('--wpapassword', type=str)
args = parser.parse_args()

original_password = args["password"]
new_password = args["new-password"]
original_password = args.password
new_password = args.newpassword

wifi_ssid = args["ssid"]
wifi_password = args["wpa-password"]
wifi_ssid = args.ssid
wifi_password = args.wpapassword

url = 'http://192.168.8.1/'
with Connection(url, password=original_password) as connection:
Expand Down
3 changes: 1 addition & 2 deletions huawei_lte_api/Session.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def _try_or_reload_and_retry(fn: Callable[..., T]) -> Callable[..., T]:
def wrapped(*args: Any, **kw: Any) -> T:
try:
return fn(*args, **kw)
except ResponseErrorLoginCsrfException as e:
print("Retry because " + str(e))
except ResponseErrorLoginCsrfException:
args[0].reload()
return fn(*args, **kw)

Expand Down
2 changes: 1 addition & 1 deletion huawei_lte_api/api/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def device_feature_switch(self) -> GetResponseType:
def basic_information(self) -> GetResponseType:
return self._session.get('device/basic_information')

def set_basic_information(self, restore_default_status = False) -> SetResponseType:
def set_basic_information(self, restore_default_status: bool = False) -> SetResponseType:
return self._session.post_set('device/basic_information',
{
"restore_default_status": 1 if restore_default_status else 0
Expand Down
6 changes: 3 additions & 3 deletions huawei_lte_api/api/User.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class User(ApiGroup):
def state_login(self) -> GetResponseType:
return self._session.get('user/state-login')

def state_login_with_retry(self) -> GetResponseType:
def _state_login_with_retry(self) -> GetResponseType:
tries = 5
for i in range(tries):
try:
Expand All @@ -65,7 +65,7 @@ def state_login_with_retry(self) -> GetResponseType:

raise ResponseErrorException(message="Tries exhausted", code=0)

def _encode_password(self, username: str, password: Optional[str], password_type: PasswordTypeEnum = PasswordTypeEnum.BASE_64):
def _encode_password(self, username: str, password: Optional[str], password_type: PasswordTypeEnum = PasswordTypeEnum.BASE_64) -> bytes:
if not password:
return b''

Expand Down Expand Up @@ -117,7 +117,7 @@ def login(self, username: str = DEFAULT_USERNAME, password: Optional[str] = None
username = DEFAULT_USERNAME

try:
state_login = self.state_login_with_retry()
state_login = self._state_login_with_retry()
except ResponseErrorNotSupportedException:
return True

Expand Down

0 comments on commit 1cbe6e0

Please sign in to comment.