Nihilate / Roboragi

Roboragi is a Reddit bot which helps link anime, manga, and other Japanese media.
GNU Affero General Public License v3.0
167 stars 30 forks source link

Make DatabaseHandler.py more PEP8 compliant #60

Closed reillysiemens closed 6 years ago

reillysiemens commented 6 years ago

PEP8 compliance (according to flake8) before and after the changes in this PR. This is part of addressing #16.

(roboragi) [14:31:42] tucker@khanti:~/Projects/Roboragi git:(master) $ flake8 roboragi/DatabaseHandler.py 
roboragi/DatabaseHandler.py:3:80: E501 line too long (106 > 79 characters)
roboragi/DatabaseHandler.py:42:80: E501 line too long (104 > 79 characters)
roboragi/DatabaseHandler.py:46:80: E501 line too long (83 > 79 characters)
roboragi/DatabaseHandler.py:50:80: E501 line too long (112 > 79 characters)
roboragi/DatabaseHandler.py:51:5: E722 do not use bare except'
roboragi/DatabaseHandler.py:59:80: E501 line too long (198 > 79 characters)
roboragi/DatabaseHandler.py:69:80: E501 line too long (139 > 79 characters)
roboragi/DatabaseHandler.py:82:80: E501 line too long (109 > 79 characters)
roboragi/DatabaseHandler.py:87:80: E501 line too long (113 > 79 characters)
roboragi/DatabaseHandler.py:99:80: E501 line too long (80 > 79 characters)
roboragi/DatabaseHandler.py:113:80: E501 line too long (86 > 79 characters)
roboragi/DatabaseHandler.py:119:80: E501 line too long (106 > 79 characters)
roboragi/DatabaseHandler.py:128:80: E501 line too long (95 > 79 characters)
roboragi/DatabaseHandler.py:141:80: E501 line too long (89 > 79 characters)
roboragi/DatabaseHandler.py:145:80: E501 line too long (94 > 79 characters)
roboragi/DatabaseHandler.py:162:80: E501 line too long (124 > 79 characters)
roboragi/DatabaseHandler.py:170:80: E501 line too long (137 > 79 characters)
roboragi/DatabaseHandler.py:187:80: E501 line too long (103 > 79 characters)
roboragi/DatabaseHandler.py:197:80: E501 line too long (110 > 79 characters)
roboragi/DatabaseHandler.py:204:80: E501 line too long (99 > 79 characters)
roboragi/DatabaseHandler.py:215:5: E722 do not use bare except'
roboragi/DatabaseHandler.py:221:80: E501 line too long (95 > 79 characters)
roboragi/DatabaseHandler.py:227:80: E501 line too long (93 > 79 characters)
roboragi/DatabaseHandler.py:233:80: E501 line too long (87 > 79 characters)
roboragi/DatabaseHandler.py:234:80: E501 line too long (86 > 79 characters)
roboragi/DatabaseHandler.py:236:80: E501 line too long (93 > 79 characters)
roboragi/DatabaseHandler.py:242:80: E501 line too long (87 > 79 characters)
roboragi/DatabaseHandler.py:243:80: E501 line too long (86 > 79 characters)
roboragi/DatabaseHandler.py:246:80: E501 line too long (90 > 79 characters)
roboragi/DatabaseHandler.py:248:58: W291 trailing whitespace
roboragi/DatabaseHandler.py:253:80: E501 line too long (113 > 79 characters)
roboragi/DatabaseHandler.py:258:80: E501 line too long (86 > 79 characters)
roboragi/DatabaseHandler.py:275:80: E501 line too long (106 > 79 characters)
roboragi/DatabaseHandler.py:290:80: E501 line too long (94 > 79 characters)
roboragi/DatabaseHandler.py:291:80: E501 line too long (80 > 79 characters)
roboragi/DatabaseHandler.py:296:80: E501 line too long (91 > 79 characters)
roboragi/DatabaseHandler.py:303:80: E501 line too long (91 > 79 characters)
roboragi/DatabaseHandler.py:310:80: E501 line too long (111 > 79 characters)
roboragi/DatabaseHandler.py:321:80: E501 line too long (108 > 79 characters)
roboragi/DatabaseHandler.py:331:80: E501 line too long (145 > 79 characters)
roboragi/DatabaseHandler.py:339:80: E501 line too long (158 > 79 characters)
(roboragi) [14:31:48] tucker@khanti:~/Projects/Roboragi git:(master) $ git co pep8-database-handler
Switched to branch 'pep8-database-handler'
(roboragi) [14:31:56] tucker@khanti:~/Projects/Roboragi git:(pep8-database-handler) $ flake8 roboragi/DatabaseHandler.py
(roboragi) [14:32:00] tucker@khanti:~/Projects/Roboragi git:(pep8-database-handler) $

The bulk of the changes here are reformatting SQL queries. I didn't edit any of the queries themselves, but in the absence of tests and real data to execute them on this will need careful review.

I did verify locally that psycopg2.connect can accept keyword arguments in place of a DSN, so that shouldn't cause any issues.

Nihilate commented 6 years ago

Looks good!