Fix PEP-8 issues with some more code.

Review Request #4424 — Created Aug. 12, 2013 and submitted

Information

Review Board
master

Reviewers

Fix PEP-8 issues with some more code.

This addresses problems in the attachments, changedescs, cmdline, and
diffviewer modules.
Ran unit tests, pep8 command-line tool.
Description From Last Updated

This doesn't really help readability of the content, but concatenating strings is bad anyway. While you're here, can you turn …

chipx86chipx86

We may as well improve the localization here and use a dictionary for arguments.

chipx86chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/diffviewer/chunk_generator.py
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/tests.py
        reviewboard/attachments/__init__.py
        reviewboard/diffviewer/smdiff.py
        reviewboard/diffviewer/evolutions/add_diff_hash.py
        reviewboard/diffviewer/parser.py
        reviewboard/diffviewer/evolutions/filediff_status.py
        reviewboard/changedescs/tests.py
        reviewboard/cmdline/rbsite.py
        reviewboard/attachments/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/diffviewer/opcode_generator.py
        reviewboard/diffviewer/templatetags/difftags.py
        reviewboard/attachments/mimetypes.py
        reviewboard/diffviewer/myersdiff.py
        reviewboard/diffviewer/differ.py
        reviewboard/diffviewer/evolutions/add_parent_diffs.py
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/diffutils.py
        reviewboard/cmdline/rbssh.py
        reviewboard/attachments/tests.py
        reviewboard/diffviewer/views.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/diffviewer/chunk_generator.py
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/tests.py
        reviewboard/attachments/__init__.py
        reviewboard/diffviewer/smdiff.py
        reviewboard/diffviewer/evolutions/add_diff_hash.py
        reviewboard/diffviewer/parser.py
        reviewboard/diffviewer/evolutions/filediff_status.py
        reviewboard/changedescs/tests.py
        reviewboard/cmdline/rbsite.py
        reviewboard/attachments/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/diffviewer/opcode_generator.py
        reviewboard/diffviewer/templatetags/difftags.py
        reviewboard/attachments/mimetypes.py
        reviewboard/diffviewer/myersdiff.py
        reviewboard/diffviewer/differ.py
        reviewboard/diffviewer/evolutions/add_parent_diffs.py
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/diffutils.py
        reviewboard/cmdline/rbssh.py
        reviewboard/attachments/tests.py
        reviewboard/diffviewer/views.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/cmdline/rbsite.py (Diff revision 1)
     
     
    Show all issues
    This doesn't really help readability of the content, but concatenating strings is bad anyway. While you're here, can you turn this into one big list statement that's joined?
  3. reviewboard/cmdline/rbsite.py (Diff revision 1)
     
     
     
     
    Hmmm, yeah, I hate this so much. I don't really have a suggestion, but I hate it, and I don't expect I'll be writing code that looks like this.
    
    I would much, much rather ignore what the pep8 tool says here. This is a warning form the tool, not PEP-8 itself, and from discussions on their bug tracker, it's clearly the developers' preference, which is less "holy" than PEP-8 (which is itself very inconsistent with how it does multi-line if statements). A bunch of code shipped with Python uses the left-hand side.
    
    (Relevant discussion involving this in the pep8 tool is at https://github.com/jcrocholl/pep8/issues/126, and also buried in some other tickets elsewhere.)
    
    My personal preference is to just keep them aligned. There's the issue of figuring out where the if statement ends and the other code begins, but I don't feel we've realistically had a problem with this over the many years of writing Review Board (or, for that matter, C code that has braces on the same line as the if statement), and maybe it just will encourage more useful comments in the body.
  4. reviewboard/diffviewer/diffutils.py (Diff revision 1)
     
     
     
     
    Show all issues
    We may as well improve the localization here and use a dictionary for arguments.
    1. This is fixed in my i18n change.
  5. 
      
david
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/diffviewer/chunk_generator.py
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/tests.py
        reviewboard/attachments/__init__.py
        reviewboard/diffviewer/smdiff.py
        reviewboard/diffviewer/evolutions/add_diff_hash.py
        reviewboard/diffviewer/parser.py
        reviewboard/diffviewer/evolutions/filediff_status.py
        reviewboard/changedescs/tests.py
        reviewboard/cmdline/rbsite.py
        reviewboard/attachments/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/diffviewer/opcode_generator.py
        reviewboard/diffviewer/templatetags/difftags.py
        reviewboard/attachments/mimetypes.py
        reviewboard/diffviewer/myersdiff.py
        reviewboard/diffviewer/differ.py
        reviewboard/diffviewer/evolutions/add_parent_diffs.py
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/diffutils.py
        reviewboard/cmdline/rbssh.py
        reviewboard/attachments/tests.py
        reviewboard/diffviewer/views.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/diffviewer/chunk_generator.py
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/tests.py
        reviewboard/attachments/__init__.py
        reviewboard/diffviewer/smdiff.py
        reviewboard/diffviewer/evolutions/add_diff_hash.py
        reviewboard/diffviewer/parser.py
        reviewboard/diffviewer/evolutions/filediff_status.py
        reviewboard/changedescs/tests.py
        reviewboard/cmdline/rbsite.py
        reviewboard/attachments/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/diffviewer/opcode_generator.py
        reviewboard/diffviewer/templatetags/difftags.py
        reviewboard/attachments/mimetypes.py
        reviewboard/diffviewer/myersdiff.py
        reviewboard/diffviewer/differ.py
        reviewboard/diffviewer/evolutions/add_parent_diffs.py
        reviewboard/diffviewer/models.py
        reviewboard/diffviewer/diffutils.py
        reviewboard/cmdline/rbssh.py
        reviewboard/attachments/tests.py
        reviewboard/diffviewer/views.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. Seems fine in general.
    
    I'd still opt for changing the if statements back, and ignoring PEP-8 spacing rules for that File table, though.
    
    For what it's worth, ReviewBot is configured to ignore the former.
    1. I'll fix the table before I push. Thanks!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to master (1b49b09).