Commit 9a81da56 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Applied pyflakes and pep8.

parent aea8b483
#!/usr/bin/env python
import re
import MySQLdb as mysql
from singplur import singularize, pluralize
from singplur import singularize
from itertools import combinations
......@@ -181,9 +181,10 @@ class Model(object):
]
if self.options.get('create_accessible', True):
lines.append(self.php_attr_accessible())
lines.append(self.php_attr_accessible())
php = classdef % '\n'.join([TAB + line for line in lines if line != None])
php = classdef % '\n'.join([TAB + line
for line in lines if line is not None])
return php_block(php) if add_php_block else php
......@@ -274,10 +275,10 @@ if __name__ == '__main__':
help='MySQL username')
parser.add_argument('-p', '--password', default='mysql12#$',
help='MySQL password')
parser.add_argument('--has-one', nargs=2, dest='opt_has_one', action='append',
parser.add_argument('--has-one', nargs=2, dest='opt_has_one',
help='one-to-one relationships of the form '
'\'payment-receipt\', where one payment has one '
'receipt')
'receipt', action='append')
parser.add_argument('--namespace', default='', dest='opt_namespace',
help='PHP namespace to create models classes in')
parser.add_argument('--create-select', action='store_true',
......
......@@ -9,7 +9,7 @@ SINGULARS = (
(r'matrices', 'matrix'),
(r'([aeiou])ys', '\\1y'),
(r'([^aeiou])ies', '\\1y'),
(r'([^aeiou])ices$','\\1ice'),
(r'([^aeiou])ices$', '\\1ice'),
(r'ices', 'ex'),
(r'([sxz]|[cs]h)es$', '\\1'),
(r'eet', 'oot'),
......@@ -55,8 +55,8 @@ def apply_rules(word, rules):
if word in SAME:
return word
for pattern,replacement in rules:
word, n = re.subn(pattern + '$', replacement, word)
for pattern, replacement in rules:
word, n = re.subn(pattern + '$', replacement, word)
if n:
break
......
#!/usr/bin/env python
import os, re, sys, unittest
import os
import re
import unittest
TESTS_DIR = 'tests'
......
from unittest import TestCase
import MySQLdb as mysql
from generate import Model, php_value, php_assoc, flatten, read_tables, read_fields
from generate import Model, php_value, php_assoc, flatten, read_tables, \
read_fields
class GenerateTest(TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment