• 
      

    Do unicode migration for rbtools/api/

    Review Request #6686 — Created Dec. 9, 2014 and submitted

    Information

    RBTools
    master
    5317e31...

    Reviewers

    This change updates the code in the rbtools/api/ directory to have a correct
    separation of unicode vs bytes, and use unicode literals everywhere.

    Ran unit tests.

    Description From Last Updated

    Col: 80 E501 line too long (80 > 79 characters)

    reviewbotreviewbot

    Col: 21 E128 continuation line under-indented for visual indent

    reviewbotreviewbot

    Col: 80 E501 line too long (80 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (84 > 79 characters)

    reviewbotreviewbot

    This looks kind of funky. Can we not use a byte string and feed in key.encode('utf-8'), like: content.write(b'Content-Disposition: formd-ata; name="%s"' …

    chipx86chipx86

    Blank line between these.

    chipx86chipx86

    Blank line.

    chipx86chipx86

    Blank line.

    chipx86chipx86

    We should probably update these (and any above) to use formatting strings instead of concatenation, since the latter is slower.

    chipx86chipx86

    Same question as above.

    chipx86chipx86

    """ on the next line.

    chipx86chipx86

    This should probably be using formatting strings to.

    chipx86chipx86

    Is this needed for regexes? I'd expect r.

    chipx86chipx86

    Same here. We should also move this out and compile it so we don't have eto do that each time …

    chipx86chipx86

    repr doesn't seem like the right thing here, at least conceptually. What are we using it for?

    chipx86chipx86
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
    2. rbtools/api/request.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (80 > 79 characters)
      
    3. rbtools/api/request.py (Diff revision 1)
       
       
      Show all issues
      Col: 21
       E128 continuation line under-indented for visual indent
      
    4. rbtools/api/request.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (80 > 79 characters)
      
    5. rbtools/api/tests.py (Diff revision 1)
       
       
      Show all issues
      Col: 80
       E501 line too long (84 > 79 characters)
      
    6. 
        
    david
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
    2. 
        
    chipx86
    1. 
        
    2. rbtools/api/request.py (Diff revision 2)
       
       
       
       
      Show all issues

      This looks kind of funky. Can we not use a byte string and feed in key.encode('utf-8'), like:

      content.write(b'Content-Disposition: formd-ata; name="%s"'
                    % key.encode('utf-8'))
      
      1. The 'bytes' type in Python 3.x doesn't have a % operator, and won't until 3.5. I'll try wrapping this differently.

    3. rbtools/api/request.py (Diff revision 2)
       
       
       
      Show all issues

      Blank line between these.

    4. rbtools/api/request.py (Diff revision 2)
       
       
       
      Show all issues

      Blank line.

    5. rbtools/api/request.py (Diff revision 2)
       
       
       
      Show all issues

      Blank line.

    6. rbtools/api/request.py (Diff revision 2)
       
       
      Show all issues

      We should probably update these (and any above) to use formatting strings instead of concatenation, since the latter is slower.

      1. Between the decode, format, and re-encode, I think it's probably a wash in terms of speed, and this only happens once per API request.

    7. rbtools/api/request.py (Diff revision 2)
       
       
       
      Show all issues

      Same question as above.

    8. rbtools/api/request.py (Diff revision 2)
       
       
      Show all issues

      """ on the next line.

    9. rbtools/api/request.py (Diff revision 2)
       
       
      Show all issues

      This should probably be using formatting strings to.

    10. rbtools/api/tests.py (Diff revision 2)
       
       
      Show all issues

      Is this needed for regexes? I'd expect r.

      1. It's needed if you run the regex on bytes types. It's not using the r prefix because there are no characters.

    11. rbtools/api/tests.py (Diff revision 2)
       
       
      Show all issues

      Same here.

      We should also move this out and compile it so we don't have eto do that each time in this loop.

    12. 
        
    david
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
    2. 
        
    chipx86
    1. 
        
    2. rbtools/api/request.py (Diff revision 3)
       
       
      Show all issues

      repr doesn't seem like the right thing here, at least conceptually. What are we using it for?

    3. 
        
    david
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          rbtools/api/client.py
          rbtools/api/resource.py
          rbtools/api/decorators.py
          rbtools/api/factory.py
          rbtools/api/decode.py
          rbtools/api/capabilities.py
          rbtools/api/tests.py
          rbtools/api/request.py
          rbtools/api/errors.py
          rbtools/api/utils.py
      
      
    2. 
        
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (b2d562a)