Skip to content

Scrap notes that could make it to documentation

Thor Whalen edited this page Jan 31, 2020 · 1 revision

How are "." and "~" handled in Quick Local Stores?

For example, when you want to talk relative to the current folder you're in (say your notebook folder):

QuickJsonStore('.')['tm_chordal_confusion_01.json'] = d
d = QuickJsonStore('.')['tm_chordal_confusion_01.json']

Want to be relative to home folder?

d = QuickJsonStore('~')['some/file/from/home]
d = QuickJsonStore('~/some/file')['from/home]  # same affect as the above

When you just want to talk to a full path:

d = QuickJsonStore('/')['/Users/twhalen/Downloads/tm_chordal_confusion_01.json']

What you cannot do (yet) is use the path shortcuts (. and ~) within the keys.

QuickJsonStore('/')['~/Downloads/tm_chordal_confusion_01.json']

It's of course possible to implement (just wrap the keys with a os.path.expanduser or/and os.path.abspath. But I'm not sure it should be automatic in a quick store...