Skip to content

Commit 172482f

Browse files
aliabbasrizvialda-optimizely
authored andcommitted
Enforcing styling through Travis and pep8 (#59)
1 parent ebcb9e0 commit 172482f

File tree

13 files changed

+30
-8
lines changed

13 files changed

+30
-8
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ python:
33
- "2.7"
44
- "3.4"
55
install: "pip install -r requirements/core.txt;pip install -r requirements/test.txt"
6+
before_script: "pep8"
67
script: "nosetests --with-coverage --cover-package=optimizely"
78
after_success:
89
- coveralls

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ We welcome contributions and feedback! All contributors must sign our [Contribut
2121

2222
## Style
2323

24-
We enforce PEP-8 rules with a few minor deviations.
24+
We enforce PEP-8 rules with a few minor [deviations](https://github.com/optimizely/python-sdk/blob/master/tox.ini).
2525

2626
## License
2727

optimizely/entities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14+
1415
class BaseEntity(object):
1516

1617
def __eq__(self, other):

optimizely/error_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14+
1415
class BaseErrorHandler(object):
1516
""" Class encapsulating exception handling functionality.
1617
Override with your own exception handler providing handle_error method. """

optimizely/exceptions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14+
1415
class InvalidAttributeException(Exception):
1516
""" Raised when provided attribute is invalid. """
1617
pass

optimizely/helpers/validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ def is_user_profile_valid(user_profile):
136136
if not type(user_profile) is dict:
137137
return False
138138

139-
if not UserProfile.USER_ID_KEY in user_profile:
139+
if UserProfile.USER_ID_KEY not in user_profile:
140140
return False
141141

142-
if not UserProfile.EXPERIMENT_BUCKET_MAP_KEY in user_profile:
142+
if UserProfile.EXPERIMENT_BUCKET_MAP_KEY not in user_profile:
143143
return False
144144

145145
experiment_bucket_map = user_profile.get(UserProfile.EXPERIMENT_BUCKET_MAP_KEY)

optimizely/optimizely.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def activate(self, experiment_key, user_id, attributes=None):
192192

193193
return variation.key
194194

195-
def track(self, event_key, user_id, attributes=None, event_tags=None):
195+
def track(self, event_key, user_id, attributes=None, event_tags=None):
196196
""" Send conversion event to Optimizely.
197197
198198
Args:

optimizely/user_profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Apache License, Version 2.0 (the "License");
33
# you may not use this file except in compliance with the License.
44
# You may obtain a copy of the License at
5-
#
5+
#
66
# http://www.apache.org/licenses/LICENSE-2.0
77

88
# Unless required by applicable law or agreed to in writing, software

tests/benchmarking/benchmarking_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def compute_average(values):
169169
Returns:
170170
Average of all values.
171171
"""
172-
return float(sum(values))/len(values)
172+
return float(sum(values)) / len(values)
173173

174174

175175
def compute_median(values):
@@ -185,7 +185,7 @@ def compute_median(values):
185185
sorted_values = sorted(values)
186186
num1 = (len(values) - 1) / 2
187187
num2 = len(values) / 2
188-
return float(sorted_values[num1] + sorted_values[num2])/2
188+
return float(sorted_values[num1] + sorted_values[num2]) / 2
189189

190190

191191
def display_results(results_average, results_median):

tests/helpers_tests/test_event_tag_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from optimizely.helpers import event_tag_utils
1919

20+
2021
class EventTagUtilsTest(unittest.TestCase):
2122

2223
def test_get_revenue_value__invalid_args(self):

0 commit comments

Comments
 (0)