Skip to content

Commit bd0ef77

Browse files
committed
Fixing errors reported by PEP8
1 parent 771cd91 commit bd0ef77

File tree

14 files changed

+35
-28
lines changed

14 files changed

+35
-28
lines changed

intercom/__init__.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@
1212
__version__ = '2.0-alpha'
1313

1414

15-
RELATED_DOCS_TEXT = "See https://github.com/jkeyes/python-intercom for usage examples."
16-
COMPATIBILITY_WARNING_TEXT = "It looks like you are upgrading from an older version of python-intercom. Please note that this new version (%s) is not backwards compatible." % (__version__)
17-
COMPATIBILITY_WORKAROUND_TEXT = "To get rid of this error please set Intercom.app_api_key and don't set Intercom.api_key."
18-
CONFIGURATION_REQUIRED_TEXT = "You must set both Intercom.app_id and Intercom.app_api_key to use this client."
19-
15+
RELATED_DOCS_TEXT = "See https://github.com/jkeyes/python-intercom \
16+
for usage examples."
17+
COMPATIBILITY_WARNING_TEXT = "It looks like you are upgrading from \
18+
an older version of python-intercom. Please note that this new version \
19+
(%s) is not backwards compatible." % (__version__)
20+
COMPATIBILITY_WORKAROUND_TEXT = "To get rid of this error please set \
21+
Intercom.app_api_key and don't set Intercom.api_key."
22+
CONFIGURATION_REQUIRED_TEXT = "You must set both Intercom.app_id and \
23+
Intercom.app_api_key to use this client."
2024

2125

2226
class _Config(object):
@@ -30,6 +34,7 @@ class _Config(object):
3034
timeout = 10
3135
endpoint_randomized_at = None
3236

37+
3338
class Intercom(object):
3439
_config = _Config()
3540
_class_register = {}
@@ -116,7 +121,8 @@ def _alternative_random_endpoint(cls):
116121
@property
117122
def _target_base_url(cls):
118123
if None in [cls.app_id, cls.app_api_key]:
119-
raise ArgumentError('%s %s' % (CONFIGURATION_REQUIRED_TEXT, RELATED_DOCS_TEXT))
124+
raise ArgumentError('%s %s' % (
125+
CONFIGURATION_REQUIRED_TEXT, RELATED_DOCS_TEXT))
120126
if cls._config.target_base_url is None:
121127
basic_auth_part = '%s:%s@' % (cls.app_id, cls.app_api_key)
122128
if cls.current_endpoint:
@@ -126,7 +132,6 @@ def _target_base_url(cls):
126132
cls.current_endpoint)
127133
return cls._config.target_base_url
128134

129-
130135
@property
131136
def hostname(cls):
132137
return cls._config.hostname
@@ -175,4 +180,4 @@ def endpoints(cls, value):
175180

176181
@SetterProperty
177182
def endpoint(cls, value):
178-
cls.endpoints = [value]
183+
cls.endpoints = [value]

intercom/api_operations/find.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from intercom import Intercom
22
from intercom import utils
33

4+
45
class Find(object):
56

67
@classmethod

intercom/api_operations/save.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from intercom import Intercom
22
from intercom import utils
33

4+
45
class Save(object):
56

67
@classmethod
@@ -20,7 +21,6 @@ def to_dict(self):
2021
a_dict[name] = self.__dict__[name] # direct access
2122
return a_dict
2223

23-
2424
@classmethod
2525
def from_api(cls, response):
2626
obj = cls()
@@ -43,7 +43,6 @@ def save(self):
4343
if response:
4444
return self.from_response(response)
4545

46-
4746
@property
4847
def id_present(self):
4948
return getattr(self, 'id', None) and self.id != ""

intercom/collection_proxy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def __init__(self, cls, collection, finder_url, finder_params={}):
2222
# a link to the next page of results
2323
self.next_page = None
2424

25-
2625
def __iter__(self):
2726
return self
2827

@@ -31,7 +30,7 @@ def next(self):
3130
# get the first page of results
3231
self.get_first_page()
3332

34-
# try to get a resource if there are no more in the
33+
# try to get a resource if there are no more in the
3534
# current resource iterator (StopIteration is raised)
3635
# try to get the next page of results first
3736
try:

intercom/conversation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from intercom.user import Resource
22
from intercom.api_operations.find import Find
33

4+
45
class Conversation(Resource, Find):
56
pass

intercom/errors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
class ArgumentError(ValueError):
32
pass

intercom/event.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44

55
class Event(Resource, Find):
66
pass
7-

intercom/lib/flat_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ def update(self, *args, **kwargs):
3232
def setdefault(self, key, value=None):
3333
if key not in self:
3434
self[key] = value
35-
return self[key]
35+
return self[key]

intercom/lib/typed_json_deserializer.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ def __init__(self, json):
1111
def _get_object_type(self):
1212
if self._object_type is None:
1313
self._object_type = self._json.get('type', None)
14-
# print "OBJECT TYPE IS ", self._object_type
1514
if self._object_type is None:
16-
raise Exception('No type field found to faciliate deserialization')
15+
raise Exception(
16+
'No type field found to faciliate deserialization')
1717
return self._object_type
1818

1919
@property
2020
def _is_list_type(self):
21-
# print "IS LIST TYPE", self._get_object_type
2221
return self._get_object_type.endswith('.list')
2322

2423
@property
@@ -27,14 +26,16 @@ def _object_entity_key(self):
2726

2827
def deserialize(self):
2928
if self._is_list_type:
30-
return self.deserialize_collection(self._json[self._object_entity_key])
29+
return self.deserialize_collection(
30+
self._json[self._object_entity_key])
3131
else:
3232
return self.deserialize_object(self._json)
3333

3434
def deserialize_collection(self, collection_json):
35-
return [JsonDeserializer(object_json).deserialize() for object_json in collection_json]
35+
return [JsonDeserializer(object_json).deserialize()
36+
for object_json in collection_json]
3637

3738
def deserialize_object(self, object_json):
38-
entity_class = utils.constantize_singular_resource_name(self._object_entity_key)
39+
entity_class = utils.constantize_singular_resource_name(
40+
self._object_entity_key)
3941
return entity_class.from_api(object_json)
40-

intercom/note.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from intercom.user import Resource
22
from intercom.api_operations.find import Find
33

4+
45
class Note(Resource, Find):
56
pass
6-

0 commit comments

Comments
 (0)