Skip to content

Commit

Permalink
PY3 compat fixes, PEP8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
everilae committed May 27, 2015
1 parent 9cb1777 commit 7e7facd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion gnippy/__init__.py
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# gnippy - GNIP for Python
from __future__ import absolute_import

__title__ = 'gnippy'
__version__ = '0.3.4'
__author__ = 'Abhinav Ajgaonkar'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2012-2013 Abhinav Ajgaonkar'

from powertrackclient import PowerTrackClient
from .powertrackclient import PowerTrackClient
22 changes: 14 additions & 8 deletions gnippy/config.py
@@ -1,6 +1,11 @@
# -*- coding: utf-8 -*-

import ConfigParser
try:
import configparser as ConfigParser

except ImportError:
import ConfigParser

import os

from gnippy.errors import ConfigFileNotFoundException, IncompleteConfigurationException
Expand All @@ -20,11 +25,11 @@ def get_default_config_file_path():
# os.path.expanduser() will fail. Attempt to detect this case and use a
# no-op expanduser function in this case.
try:
os.path.expanduser('~')
expanduser = os.path.expanduser
os.path.expanduser('~')
expanduser = os.path.expanduser
except (AttributeError, ImportError):
# This is probably running on App Engine.
expanduser = (lambda x: x)
# This is probably running on App Engine.
expanduser = (lambda x: x)
# ---End borrowed section ---------------------------------------------
return os.path.join(expanduser("~"), ".gnippy")

Expand Down Expand Up @@ -95,13 +100,14 @@ def resolve(kwarg_dict):
if creds['username'] and creds['password']:
conf['auth'] = (creds['username'], creds['password'])
else:
raise IncompleteConfigurationException("Incomplete authentication information provided. Please provide"\
+ " a username and password.")
raise IncompleteConfigurationException(
"Incomplete authentication information provided. "
"Please provide a username and password.")

if "url" not in conf:
if file_conf['PowerTrack']['url']:
conf['url'] = file_conf['PowerTrack']['url']
else:
raise IncompleteConfigurationException("Please provide a PowerTrack url.")

return conf
return conf

0 comments on commit 7e7facd

Please sign in to comment.