implement explicit Optional type hints for =None parameters
Thanks https://github.com/hauntsaninja/no_implicit_optional
This commit is contained in:
parent
669c82a10b
commit
82a87e7ea9
15 changed files with 34 additions and 27 deletions
|
@ -3,6 +3,8 @@ import os
|
|||
import pwd
|
||||
import subprocess
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from .cmd import run_cmd, run_root_cmd, generate_cmd_su
|
||||
|
||||
|
||||
|
@ -10,7 +12,7 @@ def get_username(id: int):
|
|||
return pwd.getpwuid(id).pw_name
|
||||
|
||||
|
||||
def run_func(f, expected_user: str = None, **kwargs):
|
||||
def run_func(f, expected_user: Optional[str] = None, **kwargs):
|
||||
current_uid = os.getuid()
|
||||
current_username = get_username(current_uid)
|
||||
target_uid = current_uid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue