Fix direct calls to superclass __init__.

Review Request #3159 — Created Nov. 21, 2015 and submitted

benjyw
pants
pants-reviews
jsirois, kwlzn
Replaces them with super() calls where possible, or adds comments
for old-style classes.

Also driveby-fixes various style issues and inspections I saw along the way,
such as a few cases where we shadow builtins or variables.

Added a couple of TODOs to consider getting rid of a couple of classes
that seem to add more complexity than benefit.

CI passes: https://travis-ci.org/pantsbuild/pants/builds/92471903

ZU
  1. 
      
  2. yikes!

    1. Fortunately that method is only called in one place, without this argument.

      IntelliJ++ for finding this. I will see if we can apply more such inspections in the linter.

  3. 
      
KW
  1. 
      
  2. probably up for debate, but I've always used 'str' in this case because that's what the builtin type is named:

    >>> type('pants')
    <type 'str'>
    

    seems there's some larger disagreement throughout the codebase tho:

    [illuminati pants (master)]$ ag ":param string " | wc -l
         291
    [illuminati pants (master)]$ ag ":param str " | wc -l
          55
    
    1. In docstrings, 'string' is apparently shorthand for str|unicode. It's also python3-proof, I think.

    2. ah, makes sense.

    3. And yet rarely is it appropriate to liberally accept either str or unicode! The vast majority of methods should know that they are explicitly working with bytes or code-points (i.e. six.text_type).

  3. 
      
BE
  1. Thanks folks. Submitted as 15e7ec1527a6460071bb79e8fbd1f21fc5a55ec6.

  2. 
      
BE
Review request changed

Status: Closed (submitted)

Change Summary:

15e7ec1527a6460071bb79e8fbd1f21fc5a55ec6

Loading...