diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..108586d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: python + +python: + - '2.7' + - '3.3' + - '3.4' + - '3.5' + - '3.6' + - pypy + +before_install: + - pip install flake8 + +install: + - pip install -r requirements.txt + +script: + - flake8 . diff --git a/requirements.txt b/requirements.txt index 8bc1c62..81d50f9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1 @@ -nose==1.3.7 -numpy==1.13.3 -protobuf==3.4.1 -pycairo==1.15.3 -twitter==1.17.1 -yasm==0.0 -zenmap==7.60 +twitter \ No newline at end of file diff --git a/twitterstatus.py b/twitterstatus.py index 1d3af83..8a2ba59 100755 --- a/twitterstatus.py +++ b/twitterstatus.py @@ -12,6 +12,11 @@ except ImportError as e: print("ERROR: Could not import config. Make sure config.py exists.") +try: + FileNotFoundError +except NameError: + FileNotFoundError = IOError + try: from wordlist import wordlist diff --git a/wordlist.py b/wordlist.py index 6f6c605..6d3d4a7 100644 --- a/wordlist.py +++ b/wordlist.py @@ -9,8 +9,6 @@ class MissingTranslationException(Exception): pass -translations = {} - def wordlist(language="en_US"): """ Returns a list of lists containing words to be used in a status update @@ -23,21 +21,18 @@ def wordlist(language="en_US"): * fill words - good * fill words - bad """ - if language in translations: - return translations[language] - else: - path = './words/{0}/wordlist.json'.format( - language) - if os.path.exists(path): + translations = {} + path = './words/{0}/wordlist.json'.format( + language) - with open(path) as wordfile: - translations[language] = json.load(wordfile) + if os.path.exists(path): - # fixup space name - translations[language][0].append(config.SPACE_NAME) - return translations[language] - else: - raise MissingTranslationException( - "No translation for %s found" % - language) + with open(path) as wordfile: + translations[language] = json.load(wordfile) + # fixup space name + translations[language][0].append(config.SPACE_NAME) + return translations[language] + else: + raise MissingTranslationException( + "No translation for %s found" % language)