lint: Clean up E241 PEP-8 rule.

This commit is contained in:
Tim Abbott
2017-01-23 21:21:14 -08:00
parent fe4f7b1170
commit 9cc83f87fc
17 changed files with 107 additions and 107 deletions

View File

@@ -973,7 +973,7 @@ def get_realm_activity(request, realm_str):
admin_emails = {admin.email for admin in admins}
for is_bot, page_title in [(False, 'Humans'), (True, 'Bots')]:
for is_bot, page_title in [(False, 'Humans'), (True, 'Bots')]:
all_records = list(get_user_activity_records_for_realm(realm_str, is_bot))
user_records, content = realm_user_summary_table(all_records, admin_emails)

View File

@@ -41,7 +41,7 @@ import zulip
parser = optparse.OptionParser(usage=usage)
parser.add_option('--message-id', default="")
parser.add_option('--subject', default="")
parser.add_option('--content', default="")
parser.add_option('--content', default="")
parser.add_option_group(zulip.generate_option_group(parser))
(options, args) = parser.parse_args()

View File

@@ -40,7 +40,7 @@ You can omit --user and --api-key arguments if you have a properly set up ~/.zul
parser = optparse.OptionParser(usage=usage)
parser.add_option('--subject', default="test")
parser.add_option('--message', default="test message")
parser.add_option('--type', default='private')
parser.add_option('--type', default='private')
parser.add_option_group(zulip.generate_option_group(parser))
(options, args) = parser.parse_args()

View File

@@ -9,10 +9,10 @@ VERSION = "0.9"
# In Nagios, "output" means "first line of output", and "long
# output" means "other lines of output".
parser = optparse.OptionParser() # type: optparse.OptionParser
parser.add_option('--output', default='')
parser.add_option('--output', default='')
parser.add_option('--long-output', default='')
parser.add_option('--stream', default='nagios')
parser.add_option('--config', default='/etc/nagios3/zuliprc')
parser.add_option('--stream', default='nagios')
parser.add_option('--config', default='/etc/nagios3/zuliprc')
for opt in ('type', 'host', 'service', 'state'):
parser.add_option('--' + opt)
(opts, args) = parser.parse_args() # type: Any, List[Text]

View File

@@ -76,20 +76,20 @@ if options.sharded:
("message", "p"),
("tabbott-nagios-test-32", "0"),
("tabbott-nagios-test-33", "1"),
("tabbott-nagios-test-2", "2"),
("tabbott-nagios-test-5", "3"),
("tabbott-nagios-test-2", "2"),
("tabbott-nagios-test-5", "3"),
("tabbott-nagios-test-13", "4"),
("tabbott-nagios-test-7", "5"),
("tabbott-nagios-test-7", "5"),
("tabbott-nagios-test-22", "6"),
("tabbott-nagios-test-35", "7"),
("tabbott-nagios-test-4", "8"),
("tabbott-nagios-test-3", "9"),
("tabbott-nagios-test-1", "a"),
("tabbott-nagios-test-4", "8"),
("tabbott-nagios-test-3", "9"),
("tabbott-nagios-test-1", "a"),
("tabbott-nagios-test-49", "b"),
("tabbott-nagios-test-34", "c"),
("tabbott-nagios-test-12", "d"),
("tabbott-nagios-test-11", "e"),
("tabbott-nagios-test-9", "f"),
("tabbott-nagios-test-9", "f"),
]
for (stream, test) in test_streams:
if stream == "message":

View File

@@ -7,7 +7,7 @@ i18n_urlpatterns = [
url(r'^zephyr-mirror/$', TemplateView.as_view(template_name='corporate/zephyr-mirror.html')),
# Terms of service and privacy policy
url(r'^terms-enterprise/$', TemplateView.as_view(template_name='corporate/terms-enterprise.html')),
url(r'^terms-enterprise/$', TemplateView.as_view(template_name='corporate/terms-enterprise.html')),
url(r'^privacy/$', TemplateView.as_view(template_name='corporate/privacy.html')),
]

View File

@@ -87,7 +87,7 @@ def check_pep8(files):
# ignored. It either doesn't fit with the style of the project or should
# actually be cleaned up.
#
'E123', 'E126', 'E226', 'E241', 'E261', 'E302',
'E123', 'E126', 'E226', 'E261', 'E302',
'E401', 'E501', 'E702',
#

View File

@@ -47,7 +47,7 @@ def create_pull_branch(pull_id):
print()
print('PR: %d' % (pull_id,))
print(subprocess.check_output(['git', 'log', 'HEAD~..',
print(subprocess.check_output(['git', 'log', 'HEAD~..',
'--pretty=format:Author: %an']))
def review_pr():

View File

@@ -35,34 +35,34 @@ def add_settings(request):
realm_uri = settings.SERVER_URI
return {
'custom_logo_url': settings.CUSTOM_LOGO_URL,
'register_link_disabled': settings.REGISTER_LINK_DISABLED,
'login_link_disabled': settings.LOGIN_LINK_DISABLED,
'about_link_disabled': settings.ABOUT_LINK_DISABLED,
'show_oss_announcement': settings.SHOW_OSS_ANNOUNCEMENT,
'zulip_admin': settings.ZULIP_ADMINISTRATOR,
'terms_of_service': settings.TERMS_OF_SERVICE,
'login_url': settings.HOME_NOT_LOGGED_IN,
'only_sso': settings.ONLY_SSO,
'external_api_path': settings.EXTERNAL_API_PATH,
'external_api_uri': settings.EXTERNAL_API_URI,
'external_host': settings.EXTERNAL_HOST,
'external_uri_scheme': settings.EXTERNAL_URI_SCHEME,
'realm_uri': realm_uri,
'server_uri': settings.SERVER_URI,
'api_site_required': settings.EXTERNAL_API_PATH != "api.zulip.com",
'custom_logo_url': settings.CUSTOM_LOGO_URL,
'register_link_disabled': settings.REGISTER_LINK_DISABLED,
'login_link_disabled': settings.LOGIN_LINK_DISABLED,
'about_link_disabled': settings.ABOUT_LINK_DISABLED,
'show_oss_announcement': settings.SHOW_OSS_ANNOUNCEMENT,
'zulip_admin': settings.ZULIP_ADMINISTRATOR,
'terms_of_service': settings.TERMS_OF_SERVICE,
'login_url': settings.HOME_NOT_LOGGED_IN,
'only_sso': settings.ONLY_SSO,
'external_api_path': settings.EXTERNAL_API_PATH,
'external_api_uri': settings.EXTERNAL_API_URI,
'external_host': settings.EXTERNAL_HOST,
'external_uri_scheme': settings.EXTERNAL_URI_SCHEME,
'realm_uri': realm_uri,
'server_uri': settings.SERVER_URI,
'api_site_required': settings.EXTERNAL_API_PATH != "api.zulip.com",
'email_integration_enabled': settings.EMAIL_GATEWAY_BOT != "",
'email_gateway_example': settings.EMAIL_GATEWAY_EXAMPLE,
'open_realm_creation': settings.OPEN_REALM_CREATION,
'password_auth_enabled': password_auth_enabled(realm),
'dev_auth_enabled': dev_auth_enabled(realm),
'google_auth_enabled': google_auth_enabled(realm),
'github_auth_enabled': github_auth_enabled(realm),
'development_environment': settings.DEVELOPMENT,
'support_email': settings.ZULIP_ADMINISTRATOR,
'find_team_link_disabled': settings.FIND_TEAM_LINK_DISABLED,
'password_min_length': settings.PASSWORD_MIN_LENGTH,
'password_min_quality': settings.PASSWORD_MIN_ZXCVBN_QUALITY,
'email_gateway_example': settings.EMAIL_GATEWAY_EXAMPLE,
'open_realm_creation': settings.OPEN_REALM_CREATION,
'password_auth_enabled': password_auth_enabled(realm),
'dev_auth_enabled': dev_auth_enabled(realm),
'google_auth_enabled': google_auth_enabled(realm),
'github_auth_enabled': github_auth_enabled(realm),
'development_environment': settings.DEVELOPMENT,
'support_email': settings.ZULIP_ADMINISTRATOR,
'find_team_link_disabled': settings.FIND_TEAM_LINK_DISABLED,
'password_min_length': settings.PASSWORD_MIN_LENGTH,
'password_min_quality': settings.PASSWORD_MIN_ZXCVBN_QUALITY,
}

View File

@@ -735,7 +735,7 @@ def fixup_link(link, target_blank=True):
"""Set certain attributes we want on every link."""
if target_blank:
link.set('target', '_blank')
link.set('title', url_filename(link.get('href')))
link.set('title', url_filename(link.get('href')))
def sanitize_url(url):
@@ -1337,11 +1337,11 @@ def do_convert(content, message=None, message_realm=None, possible_words=None):
if possible_words is None:
possible_words = set() # Set[Text]
db_data = {'possible_words': possible_words,
'full_names': dict((user['full_name'].lower(), user) for user in realm_users),
'short_names': dict((user['short_name'].lower(), user) for user in realm_users),
'emoji': message_realm.get_emoji(),
'stream_names': dict((stream['name'], stream) for stream in realm_streams)}
db_data = {'possible_words': possible_words,
'full_names': dict((user['full_name'].lower(), user) for user in realm_users),
'short_names': dict((user['short_name'].lower(), user) for user in realm_users),
'emoji': message_realm.get_emoji(),
'stream_names': dict((stream['name'], stream) for stream in realm_streams)}
try:
# Spend at most 5 seconds rendering.

View File

@@ -73,5 +73,5 @@ than max_api_calls! (trying to trim) %s %s" % (key, count))
# elements to trim. We'd have to go through every list item and take
# the intersection. The best we can do is expire it
self._check_within_range(zset,
lambda: client.zcount(zset, 0, now),
lambda key, max_calls: None)
lambda: client.zcount(zset, 0, now),
lambda key, max_calls: None)

View File

@@ -551,8 +551,8 @@ class UserProfile(ModelReprMixin, AbstractBaseUser, PermissionsMixin):
TUTORIAL_WAITING = u'W'
TUTORIAL_STARTED = u'S'
TUTORIAL_FINISHED = u'F'
TUTORIAL_STATES = ((TUTORIAL_WAITING, "Waiting"),
(TUTORIAL_STARTED, "Started"),
TUTORIAL_STATES = ((TUTORIAL_WAITING, "Waiting"),
(TUTORIAL_STARTED, "Started"),
(TUTORIAL_FINISHED, "Finished"))
tutorial_status = models.CharField(default=TUTORIAL_WAITING, choices=TUTORIAL_STATES, max_length=1) # type: Text
@@ -655,8 +655,8 @@ class PushDeviceToken(models.Model):
GCM = 2
KINDS = (
(APNS, 'apns'),
(GCM, 'gcm'),
(APNS, 'apns'),
(GCM, 'gcm'),
)
kind = models.PositiveSmallIntegerField(choices=KINDS) # type: int
@@ -750,8 +750,8 @@ class Recipient(ModelReprMixin, models.Model):
# N.B. If we used Django's choice=... we would get this for free (kinda)
_type_names = {
PERSONAL: 'personal',
STREAM: 'stream',
HUDDLE: 'huddle'}
STREAM: 'stream',
HUDDLE: 'huddle'}
def type_name(self):
# type: () -> str

View File

@@ -456,7 +456,7 @@ class BugdownTest(TestCase):
converted_subject = bugdown.subject_links(realm.id, msg.subject)
self.assertEqual(converted, '<p>We should fix <a href="https://trac.zulip.net/ticket/224" target="_blank" title="https://trac.zulip.net/ticket/224">#224</a> and <a href="https://trac.zulip.net/ticket/115" target="_blank" title="https://trac.zulip.net/ticket/115">#115</a>, but not issue#124 or #1124z or <a href="https://trac.zulip.net/ticket/16" target="_blank" title="https://trac.zulip.net/ticket/16">trac #15</a> today.</p>')
self.assertEqual(converted_subject, [u'https://trac.zulip.net/ticket/444'])
self.assertEqual(converted_subject, [u'https://trac.zulip.net/ticket/444'])
RealmFilter(realm=realm, pattern=r'#(?P<id>[a-zA-Z]+-[0-9]+)',
url_format_string=r'https://trac.zulip.net/ticket/%(id)s').save()
@@ -532,7 +532,7 @@ class BugdownTest(TestCase):
boring_msg = Message(sender=get_user_profile_by_email("othello@zulip.com"),
subject=u"no match here")
converted_boring_subject = bugdown.subject_links(realm.id, boring_msg.subject)
self.assertEqual(converted_boring_subject, [])
self.assertEqual(converted_boring_subject, [])
def test_is_status_message(self):
# type: () -> None

View File

@@ -14,27 +14,27 @@ import zerver.views.muting
legacy_urls = [
# These are json format views used by the web client. They require a logged in browser.
url(r'^json/invite_users$', zerver.views.invite.json_invite_users),
url(r'^json/bulk_invite_users$', zerver.views.invite.json_bulk_invite_users),
url(r'^json/refer_friend$', zerver.views.invite.json_refer_friend),
url(r'^json/settings/change$', zerver.views.user_settings.json_change_settings),
url(r'^json/invite_users$', zerver.views.invite.json_invite_users),
url(r'^json/bulk_invite_users$', zerver.views.invite.json_bulk_invite_users),
url(r'^json/refer_friend$', zerver.views.invite.json_refer_friend),
url(r'^json/settings/change$', zerver.views.user_settings.json_change_settings),
# We should remove this endpoint and all code related to it.
# It returns a 404 if the stream doesn't exist, which is confusing
# for devs, and I don't think we need to go to the server
# any more to find out about subscriptions, since they are already
# pushed to us via the event system.
url(r'^json/subscriptions/exists$', zerver.views.streams.json_stream_exists),
url(r'^json/subscriptions/exists$', zerver.views.streams.json_stream_exists),
url(r'^json/subscriptions/property$', zerver.views.streams.json_subscription_property),
url(r'^json/fetch_api_key$', zerver.views.auth.json_fetch_api_key),
url(r'^json/tutorial_send_message$', zerver.views.tutorial.json_tutorial_send_message),
url(r'^json/tutorial_status$', zerver.views.tutorial.json_tutorial_status),
url(r'^json/report_error$', zerver.views.report.json_report_error),
url(r'^json/report_send_time$', zerver.views.report.json_report_send_time),
url(r'^json/report_narrow_time$', zerver.views.report.json_report_narrow_time),
url(r'^json/report_unnarrow_time$', zerver.views.report.json_report_unnarrow_time),
url(r'^json/upload_file$', zerver.views.upload.json_upload_file),
url(r'^json/messages_in_narrow$', zerver.views.messages.json_messages_in_narrow),
url(r'^json/set_muted_topics$', zerver.views.muting.json_set_muted_topics),
url(r'^json/subscriptions/property$', zerver.views.streams.json_subscription_property),
url(r'^json/fetch_api_key$', zerver.views.auth.json_fetch_api_key),
url(r'^json/tutorial_send_message$', zerver.views.tutorial.json_tutorial_send_message),
url(r'^json/tutorial_status$', zerver.views.tutorial.json_tutorial_status),
url(r'^json/report_error$', zerver.views.report.json_report_error),
url(r'^json/report_send_time$', zerver.views.report.json_report_send_time),
url(r'^json/report_narrow_time$', zerver.views.report.json_report_narrow_time),
url(r'^json/report_unnarrow_time$', zerver.views.report.json_report_unnarrow_time),
url(r'^json/upload_file$', zerver.views.upload.json_upload_file),
url(r'^json/messages_in_narrow$', zerver.views.messages.json_messages_in_narrow),
url(r'^json/set_muted_topics$', zerver.views.muting.json_set_muted_topics),
]

View File

@@ -426,9 +426,9 @@ SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
'LOCATION': MEMCACHED_LOCATION,
'TIMEOUT': 3600,
'TIMEOUT': 3600,
'OPTIONS': {
'verify_keys': True,
'tcp_nodelay': True,
@@ -436,8 +436,8 @@ CACHES = {
}
},
'database': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'third_party_api_results',
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'third_party_api_results',
# Basically never timeout. Setting to 0 isn't guaranteed
# to work, see https://code.djangoproject.com/ticket/9595
'TIMEOUT': 2000000000,
@@ -659,7 +659,7 @@ PIPELINE = {
# in frontend_tests/zjsunit/output.js as needed.
'activity': {
'source_filenames': ('styles/activity.css',),
'output_filename': 'min/activity.css'
'output_filename': 'min/activity.css'
},
'portico': {
'source_filenames': (
@@ -734,22 +734,22 @@ JS_SPECS = {
'third/bootstrap/js/bootstrap.js',
'js/common.js',
],
'output_filename': 'min/common.js'
'output_filename': 'min/common.js'
},
'signup': {
'source_filenames': [
'js/portico/signup.js',
'node_modules/jquery-validation/dist/jquery.validate.js',
],
'output_filename': 'min/signup.js'
'output_filename': 'min/signup.js'
},
'api': {
'source_filenames': ['js/portico/api.js'],
'output_filename': 'min/api.js'
'output_filename': 'min/api.js'
},
'app_debug': {
'source_filenames': ['js/debug.js'],
'output_filename': 'min/app_debug.js'
'output_filename': 'min/app_debug.js'
},
'app': {
'source_filenames': [
@@ -951,60 +951,60 @@ LOGGING = {
},
'handlers': {
'zulip_admins': {
'level': 'ERROR',
'class': 'zerver.logging_handlers.AdminZulipHandler',
'level': 'ERROR',
'class': 'zerver.logging_handlers.AdminZulipHandler',
# For testing the handler delete the next line
'filters': ['ZulipLimiter', 'require_debug_false', 'require_really_deployed'],
'filters': ['ZulipLimiter', 'require_debug_false', 'require_really_deployed'],
'formatter': 'default'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'default'
},
'file': {
'level': 'DEBUG',
'class': 'logging.handlers.WatchedFileHandler',
'formatter': 'default',
'filename': FILE_LOG_PATH,
'level': 'DEBUG',
'class': 'logging.handlers.WatchedFileHandler',
'formatter': 'default',
'filename': FILE_LOG_PATH,
},
'errors_file': {
'level': 'WARNING',
'class': 'logging.handlers.WatchedFileHandler',
'formatter': 'default',
'filename': ERROR_FILE_LOG_PATH,
'level': 'WARNING',
'class': 'logging.handlers.WatchedFileHandler',
'formatter': 'default',
'filename': ERROR_FILE_LOG_PATH,
},
},
'loggers': {
'': {
'handlers': ['console', 'file', 'errors_file'],
'level': 'INFO',
'level': 'INFO',
'propagate': False,
},
'django': {
'handlers': (['zulip_admins'] if ERROR_REPORTING else [] +
['console', 'file', 'errors_file']),
'level': 'INFO',
'level': 'INFO',
'propagate': False,
},
'zulip.requests': {
'handlers': ['console', 'file', 'errors_file'],
'level': 'INFO',
'level': 'INFO',
'propagate': False,
},
'zulip.queue': {
'handlers': ['console', 'file', 'errors_file'],
'level': 'WARNING',
'level': 'WARNING',
'propagate': False,
},
'zulip.management': {
'handlers': ['file', 'errors_file'],
'level': 'INFO',
'level': 'INFO',
'propagate': False,
},
'requests': {
'handlers': ['console', 'file', 'errors_file'],
'level': 'WARNING',
'level': 'WARNING',
'propagate': False,
},
'django.security.DisallowedHost': {

View File

@@ -87,9 +87,9 @@ TUTORIAL_ENABLED = False
# Disable use of memcached for caching
CACHES['database'] = {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
'LOCATION': 'zulip-database-test-cache',
'TIMEOUT': 3600,
'TIMEOUT': 3600,
'CONN_MAX_AGE': 600,
'OPTIONS': {
'MAX_ENTRIES': 100000

View File

@@ -116,7 +116,7 @@ i18n_urls = [
# Login/registration
url(r'^register/$', zerver.views.registration.accounts_home, name='register'),
url(r'^login/$', zerver.views.auth.login_page, {'template_name': 'zerver/login.html'}, name='zerver.views.auth.login_page'),
url(r'^login/$', zerver.views.auth.login_page, {'template_name': 'zerver/login.html'}, name='zerver.views.auth.login_page'),
# A registration page that passes through the domain, for totally open realms.
url(r'^register/(?P<realm_str>\S+)/$', zerver.views.registration.accounts_home_with_realm_str,
@@ -141,7 +141,7 @@ i18n_urls = [
# If a Terms of Service is supplied, add that route
if settings.TERMS_OF_SERVICE is not None:
i18n_urls += [url(r'^terms/$', TemplateView.as_view(template_name='zerver/terms.html'))]
i18n_urls += [url(r'^terms/$', TemplateView.as_view(template_name='zerver/terms.html'))]
# Make a copy of i18n_urls so that they appear without prefix for english
urls = list(i18n_urls)