Skip to content

Commit f6ddffc

Browse files
committed
PEP8 Fixes
1 parent 898ce88 commit f6ddffc

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lnxlink/modules/current_user.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
class Addon:
1111
"""Monitor the currently active interactive graphical users. This module
12-
ignores users with locked sessions and non-graphical sessions like SSH.
13-
If multiple users are logged in, they are separated by ', '. If no users
14-
are logged in, the sensor reads as 'No user'.
12+
ignores users with locked sessions and non-graphical sessions like SSH.
13+
If multiple users are logged in, they are separated by ', '. If no users
14+
are logged in, the sensor reads as 'No user'.
1515
16-
Requires `loginctl` command to be available."""
16+
Requires `loginctl` command to be available."""
1717

1818
def __init__(self, lnxlink):
1919
self.name = "Current Users"
@@ -24,12 +24,11 @@ def __init__(self, lnxlink):
2424
raise SystemError("Could not find loginctl command")
2525

2626
def get_info(self) -> str:
27+
"""Gather information from the system"""
2728
active_users = self._get_users()
2829
if not active_users:
2930
return "No user"
30-
else:
31-
return ", ".join(active_users)
32-
31+
return ", ".join(active_users)
3332

3433
def exposed_controls(self):
3534
"""Exposes to home assistant"""
@@ -42,7 +41,6 @@ def exposed_controls(self):
4241
},
4342
}
4443

45-
4644
def _get_sessions(self) -> list:
4745
"""Returns all the current sessions"""
4846
stdout, _, returncode = syscommand("loginctl --json=short list-sessions")
@@ -52,11 +50,10 @@ def _get_sessions(self) -> list:
5250

5351
return json.loads(stdout)
5452

55-
5653
def _get_users(self) -> set[str]:
5754
"""Returns the set of users with active, unlocked, graphical sessions.
58-
Normally computers only have 1 seat, so unlikely we'll get more than
59-
one."""
55+
Normally computers only have 1 seat, so unlikely we'll get more than
56+
one."""
6057
sessions = self._get_sessions()
6158

6259
active_users = set()

0 commit comments

Comments
 (0)