formatted

This commit is contained in:
Anish Lakhwara 2022-03-17 14:07:20 +10:00
parent d9a9e93fab
commit 8ce3e39764

View file

@ -5,6 +5,8 @@ from os import listdir, path
from shared.censor import privateList
# TODO don't hardcode the path
def loadTagFile(path='/home/anish/vimwiki/.vimwiki_tags'):
# Available file information keys:
# opened - was the tag file successfully opened?
@ -22,6 +24,7 @@ def loadTagFile(path='/home/anish/vimwiki/.vimwiki_tags'):
print("No tagfile at {}".format(path))
sys.exit(1)
def makeSetFromTags(tagFile, key='file'):
# Available TagEntry keys:
# name - name of tag
@ -41,6 +44,7 @@ def makeSetFromTags(tagFile, key='file'):
tag = tagFile.next(entry)
return AllFileList
def makeDictFromTags(tagFile, key='name', value='file'):
entry = TagEntry()
tag = tagFile.next(entry)
@ -57,20 +61,25 @@ def makeDictFromTags(tagFile, key='name', value='file'):
tag = tagFile.next(entry)
return ret
def getAllFilesWithTags():
# Returns a set containing all the files we wish to make public
return makeSetFromTags(loadTagFile())
def getAllFiles():
files = [f for f in listdir('/home/anish/vimwiki') if '.wiki' in f and path.isfile('/home/anish/vimwiki/' + f)]
files = [f for f in listdir(
'/home/anish/vimwiki') if '.wiki' in f and path.isfile('/home/anish/vimwiki/' + f)]
files = set(files)
return files
def getUntaggedFiles():
allFiles = getAllFiles()
allTags = getAllFilesWithTags()
return allFiles - allTags
def getAllTags():
# Returns a dictionary with:
# - key as tag titles