381 if "-o noquote" not in complete_stmt:
382 out, need_quotes = quote_paths(out, "", "")
383 if "-o nospace" in complete_stmt:
384 out = set([x.rstrip() for x in out])385
386 return out, max(len(prefix) - strip_len, 0)
387
Although there is nothing syntactically wrong with this code, it is hard to read and can be simplified to a set comprehension. Using set comprehension is more performant since there is no need to create a transient list.
mapping = set([num for num in my_magic_nums])
mapping = {num for num in my_magic_nums}