diff --git a/von/puid.py b/von/puid.py index 20170f0..d2c9116 100644 --- a/von/puid.py +++ b/von/puid.py @@ -1,6 +1,8 @@ import hashlib import re +from rc import VON_CUSTOM_LOOKUP + lookup = { "Afghanistan": "AFG", "Albania": "ALB", @@ -207,6 +209,7 @@ lookup["USAMTS"] = "USMT" lookup["USA GST"] = "USAEST" +lookup.update(VON_CUSTOM_LOOKUP) # whooooo REGEX = r"(?P[a-zA-Z][a-zA-Z0-9 ]+)(19|20)(?P[0-9][0-9])(?P[ \/](?P[0-9A-Za-z\.\/\- ]+))?$" re_generic = re.compile(REGEX) diff --git a/von/rc.py b/von/rc.py index f45dac9..4c3560b 100644 --- a/von/rc.py +++ b/von/rc.py @@ -49,7 +49,15 @@ # Name of text editor to invoke # By default, it detects from $EDITOR automatically -# editor: vim""" +# editor: vim + +# If you would like to define a custom contest name (to be used in the PUID script), +# then you should define it here. +# This will also override any "standard" lookups in `puid.py`. +# abbreviations: +# Inter Galaxy Math Olympiad: IGMO +# Inter Universe Math Olympiad: IUMO +""" if not CONFIG_DIR.exists(): try: @@ -112,6 +120,8 @@ else: USER_OS = "linux" # including cygwin +VON_CUSTOM_LOOKUP = config.get("abbreviations", {}) + # These used to be editable but I don't think it's worth it VON_INDEX_NAME = "index" VON_INDEX_PATH = os.path.join(VON_BASE_PATH, VON_INDEX_NAME)