Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkHedleyJones committed May 30, 2024
1 parent 9905ec4 commit b1cd15d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/dmenu_extended/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def menu(self, items, prompt=""):
text=True,
)

if type(items) == list:
if isinstance(items, list):
items = "\n".join(items)

# Prevent rofi from closing with no prompt
Expand Down Expand Up @@ -688,15 +688,15 @@ def command_to_list(self, command):
strings. Also handles lists that contain strings that contain spaces.
"""
out = []
if type(command) == list:
if isinstance(command, list):
tmp = []
for i, item in enumerate(command):
if item.find(" ") != -1:
tmp = tmp + item.split(" ")
else:
tmp = tmp + [item]
out = tmp
elif type(command) == str:
elif isinstance(command, str):
out = command.split(" ")

quote_count = "".join(out).count('"')
Expand Down Expand Up @@ -770,7 +770,7 @@ def cache_regenerate(self, message=True):
def cache_save(self, items, path):
try:
with open(path, "w") as f:
if type(items) == list:
if isinstance(items, list):
for item in items:
f.write(item + "\n")
else:
Expand Down Expand Up @@ -853,7 +853,7 @@ def cache_load(self, exitOnFail=False):
return cache_plugins + cache_frequent + cache_scanned + settings

def command_output(self, command, split=True):
if type(command) != list:
if isinstance(command, list):
command = command.split(" ")
out = subprocess.check_output(command, text=True)
if split:
Expand Down Expand Up @@ -1197,7 +1197,7 @@ def build_cache(self):
if "include_items" in self.prefs:
include_items = []
for item in self.prefs["include_items"]:
if type(item) == list:
if isinstance(item, list):
if len(item) > 1:
aliased_items.append(self.format_alias(item[0], item[1]))
aliases.append([self.format_alias(item[0], item[1]), item[1]])
Expand Down Expand Up @@ -1887,7 +1887,7 @@ def run(*args):
print("Starting to match given command with store elements")

for item in d.prefs["include_items"]:
if action == "+" and type(item) == list:
if action == "+" and isinstance(item, list):
if d.debug:
print(
"Is (+) " + str(item[0]) + " == " + str(alias) + "?"
Expand All @@ -1901,7 +1901,7 @@ def run(*args):
print("No")

# If removing a command - an alias would be detected as command
if action == "-" and type(item) == list:
if action == "-" and isinstance(item, list):
if d.debug:
print(
"Is (-) "
Expand Down Expand Up @@ -1968,7 +1968,7 @@ def run(*args):
elif d.debug:
print("No")

if type(item) != list:
if isinstance(item, list):
if d.debug:
print("Is " + str(item) + " == " + str(command) + "?")
if command == item:
Expand Down

0 comments on commit b1cd15d

Please sign in to comment.