From dcf740d85ef49e0d524944da0935686362ca3721 Mon Sep 17 00:00:00 2001
From: Tyler Doyle <t8y8@users.noreply.github.com>
Date: Fri, 9 Sep 2016 17:43:39 -0700
Subject: [PATCH] PEP8 compliance and enable TravisCI

Bring this into pep8 compliance and enable pycodestyle (the future of pep8) in travisCI (#27)
---
 .travis.yml                                        |  4 ++--
 samples/explore_datasource.py                      | 14 +-------------
 samples/explore_workbook.py                        |  2 +-
 setup.py                                           |  2 +-
 tableauserverclient/models/datasource_item.py      |  2 +-
 tableauserverclient/models/exceptions.py           |  2 +-
 tableauserverclient/models/user_item.py            |  2 +-
 tableauserverclient/models/workbook_item.py        |  2 +-
 tableauserverclient/namespace.py                   |  2 +-
 .../server/endpoint/projects_endpoint.py           |  2 --
 tableauserverclient/server/exceptions.py           |  2 +-
 test/test_request_option.py                        |  8 --------
 test/test_view.py                                  |  2 +-
 13 files changed, 12 insertions(+), 34 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 656e169f7..b0d0b8b7b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,10 +8,10 @@ python:
 # command to install dependencies
 install:
   - "pip install -e ."
-  # - "pip install pep8"
+  - "pip install pycodestyle"
 # command to run tests
 script:
   # Tests
   - python setup.py test
   # pep8 - disabled for now until we can scrub the files to make sure we pass before turning it on
-  # - pep8 .
+  - pycodestyle .
diff --git a/samples/explore_datasource.py b/samples/explore_datasource.py
index c883cf694..6b4d2e04f 100644
--- a/samples/explore_datasource.py
+++ b/samples/explore_datasource.py
@@ -31,11 +31,10 @@
 logging_level = getattr(logging, args.logging_level.upper())
 logging.basicConfig(level=logging_level)
 
-##### SIGN IN #####
+# SIGN IN
 tableau_auth = TSC.TableauAuth(args.username, password)
 server = TSC.Server(args.server)
 with server.auth.sign_in(tableau_auth):
-
     # Query projects for use when demonstrating publishing and updating
     pagination_item, all_projects = server.projects.get()
     default_project = next((project for project in all_projects if project.is_default()), None)
@@ -63,14 +62,3 @@
         print("\nConnections for {}: ".format(sample_datasource.name))
         print(["{0}({1})".format(connection.id, connection.datasource_name)
                for connection in sample_datasource.connections])
-
-
-
-
-
-
-
-
-
-
-
diff --git a/samples/explore_workbook.py b/samples/explore_workbook.py
index 0dc0229ca..482408bf3 100644
--- a/samples/explore_workbook.py
+++ b/samples/explore_workbook.py
@@ -32,7 +32,7 @@
 logging_level = getattr(logging, args.logging_level.upper())
 logging.basicConfig(level=logging_level)
 
-##### SIGN IN #####
+# SIGN IN
 tableau_auth = TSC.TableauAuth(args.username, password)
 server = TSC.Server(args.server)
 with server.auth.sign_in(tableau_auth):
diff --git a/setup.py b/setup.py
index 7854741ac..e3b68d795 100644
--- a/setup.py
+++ b/setup.py
@@ -20,4 +20,4 @@
     tests_require=[
         'requests-mock>=1.0,<1.1a0'
     ]
-)
\ No newline at end of file
+)
diff --git a/tableauserverclient/models/datasource_item.py b/tableauserverclient/models/datasource_item.py
index 90fa5c753..9f65f5419 100644
--- a/tableauserverclient/models/datasource_item.py
+++ b/tableauserverclient/models/datasource_item.py
@@ -113,7 +113,7 @@ def from_response(cls, resp):
              tags, project_id, project_name, owner_id) = cls._parse_element(datasource_xml)
             datasource_item = cls(project_id)
             datasource_item._set_values(id, name, datasource_type, content_url, created_at, updated_at,
-                            tags, None, project_name, owner_id)
+                                        tags, None, project_name, owner_id)
             all_datasource_items.append(datasource_item)
         return all_datasource_items
 
diff --git a/tableauserverclient/models/exceptions.py b/tableauserverclient/models/exceptions.py
index 8e5250d42..28d738e73 100644
--- a/tableauserverclient/models/exceptions.py
+++ b/tableauserverclient/models/exceptions.py
@@ -1,2 +1,2 @@
 class UnpopulatedPropertyError(Exception):
-    pass
\ No newline at end of file
+    pass
diff --git a/tableauserverclient/models/user_item.py b/tableauserverclient/models/user_item.py
index 3c530e676..a63db6908 100644
--- a/tableauserverclient/models/user_item.py
+++ b/tableauserverclient/models/user_item.py
@@ -144,7 +144,7 @@ def from_response(cls, resp):
              fullname, email, auth_setting, domain_name) = cls._parse_element(user_xml)
             user_item = cls(name, site_role)
             user_item._set_values(id, name, site_role, last_login, external_auth_user_id,
-                            fullname, email, auth_setting, domain_name)
+                                  fullname, email, auth_setting, domain_name)
             all_user_items.add(user_item)
         return all_user_items
 
diff --git a/tableauserverclient/models/workbook_item.py b/tableauserverclient/models/workbook_item.py
index 6522ebdef..01d1b5109 100644
--- a/tableauserverclient/models/workbook_item.py
+++ b/tableauserverclient/models/workbook_item.py
@@ -163,7 +163,7 @@ def from_response(cls, resp):
 
             workbook_item = cls(project_id)
             workbook_item._set_values(id, name, content_url, created_at, updated_at,
-                            size, show_tabs, None, project_name, owner_id, tags, views)
+                                      size, show_tabs, None, project_name, owner_id, tags, views)
             all_workbook_items.append(workbook_item)
         return all_workbook_items
 
diff --git a/tableauserverclient/namespace.py b/tableauserverclient/namespace.py
index 5f18a125e..394df63f2 100644
--- a/tableauserverclient/namespace.py
+++ b/tableauserverclient/namespace.py
@@ -1 +1 @@
-NAMESPACE = {'t': 'http://tableau.com/api'}
\ No newline at end of file
+NAMESPACE = {'t': 'http://tableau.com/api'}
diff --git a/tableauserverclient/server/endpoint/projects_endpoint.py b/tableauserverclient/server/endpoint/projects_endpoint.py
index a4242925b..061469ce3 100644
--- a/tableauserverclient/server/endpoint/projects_endpoint.py
+++ b/tableauserverclient/server/endpoint/projects_endpoint.py
@@ -51,5 +51,3 @@ def create(self, project_item):
         new_project = ProjectItem.from_response(server_response.text)[0]
         logger.info('Created new project (ID: {0})'.format(new_project.id))
         return new_project
-
-
diff --git a/tableauserverclient/server/exceptions.py b/tableauserverclient/server/exceptions.py
index 0f5dfa224..09d3d0541 100644
--- a/tableauserverclient/server/exceptions.py
+++ b/tableauserverclient/server/exceptions.py
@@ -1,2 +1,2 @@
 class NotSignedInError(Exception):
-    pass
\ No newline at end of file
+    pass
diff --git a/test/test_request_option.py b/test/test_request_option.py
index 1b1f6a13e..efb92440b 100644
--- a/test/test_request_option.py
+++ b/test/test_request_option.py
@@ -89,11 +89,3 @@ def test_filter_tags_in(self):
         self.assertEqual(set(['weather']), matching_workbooks[0].tags)
         self.assertEqual(set(['safari']), matching_workbooks[1].tags)
         self.assertEqual(set(['sample']), matching_workbooks[2].tags)
-
-
-
-
-
-
-
-
diff --git a/test/test_view.py b/test/test_view.py
index 245544cfb..a8ff5e99f 100644
--- a/test/test_view.py
+++ b/test/test_view.py
@@ -62,4 +62,4 @@ def test_populate_preview_image_missing_id(self):
 
         single_view._id = None
         single_view._workbook_id = '3cc6cd06-89ce-4fdc-b935-5294135d6d42'
-        self.assertRaises(TSC.MissingRequiredFieldError, self.server.views.populate_preview_image, single_view)
\ No newline at end of file
+        self.assertRaises(TSC.MissingRequiredFieldError, self.server.views.populate_preview_image, single_view)