title: PyCharm getitem warning for functions with arrays
body: <p>I'm getting code inspection warnings from PyCharm.  I understand the logic, but I'm not clear on the appropriate way to fix it.  Say I have the following example function:</p>
  
  <pre><code>def get_ydata(xdata):
      ydata = xdata ** 2
      for i in range(len(ydata)):
          print ydata[i]
  return ydata
  </code></pre>
  
  <p>I get 2 warnings:</p>
  
  <pre><code>&gt;&gt; Expected type 'Sized', got 'int' instead (at line 3)
  &gt;&gt; Class 'int' does not define '__getitem__', so the '[]' operator cannot be used on its instances (at line 4)
  </code></pre>
  
  <p>The purpose of the function is of course to parse a numpy array of xdata.  But PyCharm doesn't know that, so without any further indication assumes that xdata (and therefore also ydata) is an integer.</p>
  
  <p>What is the appropriate way to address this warning?  I should note that adding a type checking line will fix the warning.  Is that the optimal solution?  For example:</p>
  
  <pre><code>if not type(ydata) is np.ndarray:
      ydata = np.array(ydata)
  </code></pre>
  
  <p>Lastly, adding Sphinx docstring information does not seem to have any effect on the warnings.  (warning still sees 'int' when xdata is specified as str).  Also iterating over y directly results in the following error:</p>
  
  <pre><code>for y in ydata:
  ...
  &gt;&gt; Expected 'collections.Iterable', got 'int' instead
  </code></pre>