Skip to content

Commit

Permalink
Autopep8
Browse files Browse the repository at this point in the history
  • Loading branch information
glutanimate committed Dec 8, 2017
1 parent cfeba7a commit bae0331
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions custom_text_backup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,17 @@ def constructSnippetFormatStr(self):
snippet_extensions_list = [""]
entries_status = self.config.get("optionalEntries", None)
entries_order = self.config.get("optionalEntriesOrder", None)

if entries_status:
if entries_order:
for key in entries_order:
if not entries_status.get(key, False):
continue
snippet_extensions_list.append(snippet_extensions_dict[key])
snippet_extensions_list.append(
snippet_extensions_dict[key])
else:
snippet_extensions_list += list(snippet_extensions_dict.values())
snippet_extensions_list += list(
snippet_extensions_dict.values())

self.snippet_formatstr = snippet_body.format(
snippet_extensions="\n".join(snippet_extensions_list))
Expand All @@ -206,7 +208,8 @@ def getBackupDirectory(self):
if not anki21:
# python2 requires some extra attention when handling paths
enc_conf_path = self.config["exportPath"].encode("utf-8")
export_path = os.path.expanduser(enc_conf_path).decode(sys_encoding)
export_path = os.path.expanduser(
enc_conf_path).decode(sys_encoding)
else:
export_path = os.path.expanduser(self.config["exportPath"])
try:
Expand Down Expand Up @@ -326,7 +329,8 @@ def writeBackup(self, backup_data):

if not individual_files:
# pack note snippets into a single file
out_file = os.path.join(self.export_path, slugify(filename_default))
out_file = os.path.join(
self.export_path, slugify(filename_default))
separator = "\n" + note_sep + "\n"
out_text = separator.join(backup_data[0])
with io.open(out_file, "w+", encoding="utf-8") as f:
Expand All @@ -342,7 +346,7 @@ def writeBackup(self, backup_data):
def runCmd(self, command_array):
run_args = self.run_args
if not anki21:
args = [i.format(**run_args).encode(sys_encoding)
args = [i.format(**run_args).encode(sys_encoding)
for i in command_array]
else:
args = [i.format(**run_args) for i in command_array]
Expand Down

0 comments on commit bae0331

Please sign in to comment.