Skip to content

Commit

Permalink
target: Address pylint issues in ChromeOsTarget class
Browse files Browse the repository at this point in the history
This commit also includes a autopep formatting (only ``modules=[]...``
line gets one more space).

Signed-off-by: Metin Kaya <[email protected]>
  • Loading branch information
metin-arm committed Feb 23, 2024
1 parent 8f11f23 commit 7fa9bf4
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions devlib/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,7 @@ def _get_part_name(section):
variant = section.get('CPU variant', '0x0')
name = get_cpu_name(*list(map(integer, [implementer, part, variant])))
if name is None:
name = '{}/{}/{}'.format(implementer, part, variant)
name = f'{implementer}/{part}/{variant}'
return name


Expand Down Expand Up @@ -3218,10 +3218,13 @@ def process_node(node, path, value):


class ChromeOsTarget(LinuxTarget):
"""
Class for interacting with ChromeOS targets.
"""

os = 'chromeos'

# pylint: disable=too-many-locals
# pylint: disable=too-many-locals,too-many-arguments
def __init__(self,
connection_settings=None,
platform=None,
Expand Down Expand Up @@ -3254,17 +3257,17 @@ def __init__(self,
if key in ssh_conn_params
)

super(ChromeOsTarget, self).__init__(connection_settings=self.ssh_connection_settings,
platform=platform,
working_directory=working_directory,
executables_directory=executables_directory,
connect=False,
modules=modules,
load_default_modules=load_default_modules,
shell_prompt=shell_prompt,
conn_cls=SshConnection,
is_container=is_container,
max_async=max_async)
super().__init__(connection_settings=self.ssh_connection_settings,
platform=platform,
working_directory=working_directory,
executables_directory=executables_directory,
connect=False,
modules=modules,
load_default_modules=load_default_modules,
shell_prompt=shell_prompt,
conn_cls=SshConnection,
is_container=is_container,
max_async=max_async)

# We can't determine if the target supports android until connected to the linux host so
# create unconditionally.
Expand All @@ -3286,7 +3289,7 @@ def __init__(self,
working_directory=android_working_directory,
executables_directory=android_executables_directory,
connect=False,
modules=[], # Only use modules with linux target
modules=[], # Only use modules with linux target
load_default_modules=False,
shell_prompt=shell_prompt,
conn_cls=AdbConnection,
Expand All @@ -3301,15 +3304,15 @@ def __getattr__(self, attr):
if not present, use android implementation if available.
"""
try:
return super(ChromeOsTarget, self).__getattribute__(attr)
return super().__getattribute__(attr)
except AttributeError:
if hasattr(self.android_container, attr):
return getattr(self.android_container, attr)
else:
raise
raise

def connect(self, timeout=30, check_boot_completed=True, max_async=None):
super(ChromeOsTarget, self).connect(
@asyn.asyncf
async def connect(self, timeout=30, check_boot_completed=True, max_async=None):
super().connect(
timeout=timeout,
check_boot_completed=check_boot_completed,
max_async=max_async,
Expand Down

0 comments on commit 7fa9bf4

Please sign in to comment.