Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYP: investigate/fix ignored mypy errors #37715

Closed
simonjayhawkins opened this issue Nov 9, 2020 · 25 comments
Closed

TYP: investigate/fix ignored mypy errors #37715

simonjayhawkins opened this issue Nov 9, 2020 · 25 comments
Labels
Closing Candidate May be closeable, needs more eyeballs good first issue Typing type annotations, mypy/pyright type checking

Comments

@simonjayhawkins
Copy link
Member

simonjayhawkins commented Nov 9, 2020

In #37556 # type: ignore were added to silence mypy errors to be fixed 'later'. If an ignore is needed due to a error with the type checker, a comment with a reference to the mypy issue on the github mypy issue tracker should be included.

Further investigation or PRs welcome removing these ignores or adding comments with links to mypy issues if applicable. PRs should include 'xref #37715'

PRs could address just one error, a small handful of related errors or a complete module.

grep -Ern "type: ?ignore" pandas/ currently gives 207 matches

pandas/tests/internals/test_internals.py:1258:            assert df._mgr.blocks[0].values is arr  # type:ignore[union-attr]
pandas/tests/indexes/object/test_indexing.py:73:            (pd.IndexSlice["b":"y":-1], ""),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:74:            (pd.IndexSlice["b"::-1], "b"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:75:            (pd.IndexSlice[:"b":-1], "yxdcb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:76:            (pd.IndexSlice[:"y":-1], "y"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:77:            (pd.IndexSlice["y"::-1], "yxdcb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:78:            (pd.IndexSlice["y"::-4], "yb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:80:            (pd.IndexSlice[:"a":-1], "yxdcb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:81:            (pd.IndexSlice[:"a":-2], "ydb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:82:            (pd.IndexSlice["z"::-1], "yxdcb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:83:            (pd.IndexSlice["z"::-3], "yc"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:84:            (pd.IndexSlice["m"::-1], "dcb"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:85:            (pd.IndexSlice[:"m":-1], "yx"),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:86:            (pd.IndexSlice["a":"a":-1], ""),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:87:            (pd.IndexSlice["z":"z":-1], ""),  # type: ignore[misc]
pandas/tests/indexes/object/test_indexing.py:88:            (pd.IndexSlice["m":"m":-1], ""),  # type: ignore[misc]
pandas/tests/frame/indexing/test_setitem.py:229:        + ["datetime64[ns, UTC]", "period[D]"],  # type: ignore[list-item]
pandas/tests/io/xml/test_xml.py:683:            filename, names="Col1, Col2, Col3", parser=parser  # type: ignore[arg-type]
pandas/conftest.py:330:    params=[pd.Index, pd.Series], ids=["index", "series"]  # type: ignore[list-item]
pandas/_testing/_io.py:98:            args = []  # type: ignore[assignment]
pandas/_testing/_io.py:219:                errno = getattr(err.reason, "errno", None)  # type: ignore[attr-defined]
pandas/_testing/__init__.py:574:        idx = idx_func(nentries)  # type: ignore[operator]
pandas/util/_decorators.py:93:    return wrapper  # type: ignore[return-value]
pandas/util/_decorators.py:341:        func.__signature__ = sig  # type: ignore[attr-defined]
pandas/util/_decorators.py:380:                    docstring._docstring_components  # type: ignore[union-attr]
pandas/util/_decorators.py:396:        decorated._docstring_components = (  # type: ignore[attr-defined]
pandas/core/generic.py:755:            new_values, *new_axes  # type: ignore[arg-type]
pandas/core/generic.py:4344:        return self.rename(**mapper)  # type: ignore[return-value, arg-type]
pandas/core/generic.py:4408:        return self.rename(**mapper)  # type: ignore[return-value, arg-type]
pandas/core/generic.py:10600:        cls.any = any  # type: ignore[assignment]
pandas/core/generic.py:10620:        cls.all = all  # type: ignore[assignment]
pandas/core/generic.py:10625:            NDFrame.mad.__doc__,  # type: ignore[arg-type]
pandas/core/generic.py:10638:        cls.mad = mad  # type: ignore[assignment]
pandas/core/generic.py:10661:        cls.sem = sem  # type: ignore[assignment]
pandas/core/generic.py:10683:        cls.var = var  # type: ignore[assignment]
pandas/core/generic.py:10706:        cls.std = std  # type: ignore[assignment]
pandas/core/generic.py:10721:        cls.cummin = cummin  # type: ignore[assignment]
pandas/core/generic.py:10736:        cls.cummax = cummax  # type: ignore[assignment]
pandas/core/generic.py:10751:        cls.cumsum = cumsum  # type: ignore[assignment]
pandas/core/generic.py:10766:        cls.cumprod = cumprod  # type: ignore[assignment]
pandas/core/generic.py:10793:        cls.sum = sum  # type: ignore[assignment]
pandas/core/generic.py:10819:        cls.prod = prod  # type: ignore[assignment]
pandas/core/generic.py:10836:        cls.mean = mean  # type: ignore[assignment]
pandas/core/generic.py:10852:        cls.skew = skew  # type: ignore[assignment]
pandas/core/generic.py:10871:        cls.kurt = kurt  # type: ignore[assignment]
pandas/core/generic.py:10890:        cls.median = median  # type: ignore[assignment]
pandas/core/generic.py:10908:        cls.max = max  # type: ignore[assignment]
pandas/core/generic.py:10926:        cls.min = min  # type: ignore[assignment]
pandas/core/generic.py:11049:        return self._inplace_method(other, type(self).__add__)  # type: ignore[operator]
pandas/core/generic.py:11052:        return self._inplace_method(other, type(self).__sub__)  # type: ignore[operator]
pandas/core/generic.py:11055:        return self._inplace_method(other, type(self).__mul__)  # type: ignore[operator]
pandas/core/generic.py:11059:            other, type(self).__truediv__  # type: ignore[operator]
pandas/core/generic.py:11064:            other, type(self).__floordiv__  # type: ignore[operator]
pandas/core/generic.py:11068:        return self._inplace_method(other, type(self).__mod__)  # type: ignore[operator]
pandas/core/generic.py:11071:        return self._inplace_method(other, type(self).__pow__)  # type: ignore[operator]
pandas/core/generic.py:11074:        return self._inplace_method(other, type(self).__and__)  # type: ignore[operator]
pandas/core/generic.py:11077:        return self._inplace_method(other, type(self).__or__)  # type: ignore[operator]
pandas/core/generic.py:11080:        return self._inplace_method(other, type(self).__xor__)  # type: ignore[operator]
pandas/core/dtypes/generic.py:43:    @classmethod  # type: ignore[misc]
pandas/core/dtypes/common.py:160:        return arr.astype("int64", copy=copy, casting="safe")  # type: ignore[call-arg]
pandas/core/dtypes/common.py:165:        return arr.astype("uint64", copy=copy, casting="safe")  # type: ignore[call-arg]
pandas/core/dtypes/cast.py:588:            dtype, fill_value, type(fill_value)  # type: ignore[arg-type]
pandas/core/dtypes/dtypes.py:680:            unit, tz = unit.unit, unit.tz  # type: ignore[attr-defined]
pandas/core/arrays/datetimelike.py:539:            other = self._scalar_type(other)  # type: ignore[call-arg]
pandas/core/arrays/datetimelike.py:590:            fill_value = self._scalar_type(fill_value)  # type: ignore[call-arg]
pandas/core/arrays/datetimelike.py:598:                new_fill = self._scalar_type(fill_value)  # type: ignore[call-arg]
pandas/core/arrays/datetimelike.py:660:            value = self._scalar_type(value)  # type: ignore[call-arg]
pandas/core/arrays/datetimelike.py:953:        return self._resolution_obj.attrname  # type: ignore[union-attr]
pandas/core/arrays/datetimelike.py:1777:                uniques = uniques[::-1]  # type: ignore[assignment]
pandas/core/arrays/string_.py:213:        self._dtype = StringDtype()  # type: ignore[assignment]
pandas/core/arrays/period.py:326:    @property  # type: ignore[misc]
pandas/core/arrays/boolean.py:81:    def type(self) -> Type:  # type: ignore[override]
pandas/core/arrays/interval.py:1350:    @property  # type: ignore[misc]
pandas/core/arrays/interval.py:1572:                left = self._combined.view("complex128")  # type:ignore[attr-defined]
pandas/core/arrays/floating.py:81:            [t.numpy_dtype for t in dtypes], []  # type: ignore[union-attr]
pandas/core/internals/array_manager.py:151:    def axes(self) -> List[Index]:  # type: ignore[override]
pandas/core/internals/array_manager.py:457:            if hasattr(arr, "tz") and arr.tz is None:  # type: ignore[union-attr]
pandas/core/internals/array_manager.py:459:                arr = arr._data  # type: ignore[union-attr]
pandas/core/internals/array_manager.py:462:                arr = arr._data  # type: ignore[union-attr]
pandas/core/series.py:669:    @Appender(base.IndexOpsMixin.array.__doc__)  # type: ignore[misc]
pandas/core/series.py:1097:        self._mgr = self._mgr.setitem(  # type: ignore[assignment]
pandas/core/apply.py:563:                    new_func[k] = [v]  # type:ignore[list-item]
pandas/core/nanops.py:1751:            result = type(values)._simple_new(  # type: ignore[attr-defined]
pandas/core/groupby/categorical.py:108:        return ci.set_categories(c.categories)  # type: ignore[attr-defined]
pandas/core/groupby/categorical.py:113:    return ci.add_categories(new_cats)  # type: ignore[attr-defined]
pandas/core/groupby/base.py:60:            subset = self.obj  # type: ignore[attr-defined]
pandas/core/groupby/base.py:69:            groupby = self._groupby[key]  # type: ignore[attr-defined]
pandas/core/groupby/base.py:72:            groupby = self._groupby  # type: ignore[attr-defined]
pandas/core/groupby/base.py:78:            subset, groupby=groupby, parent=self, **kwargs  # type: ignore[call-arg]
pandas/core/groupby/grouper.py:306:        self.grouper, _, self.obj = get_grouper(  # type: ignore[type-var]
pandas/core/groupby/grouper.py:393:        return self.grouper.groups  # type: ignore[union-attr]
pandas/core/indexes/datetimelike.py:85:    @staticmethod  # type: ignore[misc]
pandas/core/indexes/datetimelike.py:131:        DatetimeLikeArrayMixin._hasnans.fget  # type: ignore[attr-defined]
pandas/core/indexes/period.py:193:    @property  # type:ignore[misc]
pandas/core/indexes/period.py:200:    @property  # type:ignore[misc]
pandas/core/indexes/period.py:207:    @property  # type:ignore[misc]
pandas/core/indexes/category.py:347:            ("ordered", self.ordered),  # type: ignore[attr-defined]
pandas/core/indexes/base.py:6174:        name = index_like.name  # type: ignore[union-attr, attr-defined]
pandas/core/indexes/frozen.py:107:    __setitem__ = __setslice__ = _disabled  # type: ignore[assignment]
pandas/core/indexes/frozen.py:108:    __delitem__ = __delslice__ = _disabled  # type: ignore[assignment]
pandas/core/indexes/frozen.py:109:    pop = append = extend = _disabled  # type: ignore[assignment]
pandas/core/indexes/frozen.py:110:    remove = sort = insert = _disabled  # type: ignore[assignment]
pandas/core/indexes/multi.py:1479:            self._names[lev] = name  # type: ignore[has-type]
pandas/core/common.py:497:        return values  # type: ignore[return-value]
pandas/core/reshape/merge.py:1028:        join_names = []  # type: ignore[var-annotated]
pandas/core/ops/array_ops.py:372:        res_values = filler(res_values)  # type: ignore[operator]
pandas/core/base.py:118:            mem = self.memory_usage(deep=True)  # type: ignore[attr-defined]
pandas/core/base.py:229:            self.obj, ABCSeries  # type: ignore[attr-defined]
pandas/core/base.py:232:            return self.obj  # type: ignore[attr-defined]
pandas/core/base.py:235:            return self.obj[self._selection]  # type: ignore[attr-defined]
pandas/core/base.py:245:            self.obj, ABCDataFrame  # type: ignore[attr-defined]
pandas/core/base.py:248:            return self.obj.reindex(  # type: ignore[attr-defined]
pandas/core/base.py:253:        if len(self.exclusions) > 0:  # type: ignore[attr-defined]
pandas/core/base.py:256:            return self.obj.drop(self.exclusions, axis=1)  # type: ignore[attr-defined]
pandas/core/base.py:259:            return self.obj  # type: ignore[attr-defined]
pandas/core/base.py:268:                self.obj.columns.intersection(key)  # type: ignore[attr-defined]
pandas/core/base.py:272:                    set(key).difference(self.obj.columns)  # type: ignore[attr-defined]
pandas/core/base.py:279:            if key not in self.obj.columns:  # type: ignore[attr-defined]
pandas/core/base.py:285:            if key not in self.obj:  # type: ignore[attr-defined]
pandas/core/base.py:611:            return self.array.to_numpy(  # type: ignore[call-arg]
pandas/core/base.py:924:                self = cast("Categorical", self)  # type: ignore[assignment]
pandas/core/base.py:927:                return self._values.map(mapper)  # type: ignore[union-attr]
pandas/core/base.py:945:            values = self.astype(object)._values  # type: ignore[attr-defined]
pandas/core/base.py:1183:            return self.array.memory_usage(deep=deep)  # type: ignore[attr-defined]
pandas/core/base.py:1318:        return self[~duplicated]  # type: ignore[index]
pandas/core/frame.py:1219:            itertuple = collections.namedtuple(  # type: ignore[misc]
pandas/core/frame.py:1236:    def dot(self, other: Series) -> Series:  # type: ignore[misc]
pandas/core/frame.py:2339:            from pandas.io.stata import (  # type: ignore[no-redef]
pandas/core/frame.py:2344:            from pandas.io.stata import (  # type: ignore[no-redef]
pandas/core/frame.py:2357:        writer = statawriter(  # type: ignore[call-arg]
pandas/core/frame.py:4082:                        unique_dtype.type, tuple(dtypes_set)  # type: ignore[arg-type]
pandas/core/frame.py:5100:                arrays.append(col)  # type:ignore[arg-type]
pandas/core/frame.py:5144:    def reset_index(  # type: ignore[misc]
pandas/core/frame.py:5783:    def sort_values(  # type: ignore[override]
pandas/core/frame.py:6385:                right._mgr, array_op  # type: ignore[arg-type]
pandas/core/resample.py:142:        self.grouper = None  # type: ignore[assignment]
pandas/core/resample.py:465:                self.loffset,  # type: ignore[has-type]
pandas/core/resample.py:474:            result.index = result.index + self.loffset  # type: ignore[has-type]
pandas/core/resample.py:911:        return self._downsample("std", ddof=ddof)  # type: ignore[call-arg]
pandas/core/resample.py:929:        return self._downsample("var", ddof=ddof)  # type: ignore[call-arg]
pandas/core/resample.py:989:        return self._downsample("quantile", q=q, **kwargs)  # type: ignore[call-arg]
pandas/core/resample.py:1042:        super().__init__(None)  # type: ignore[call-arg]
pandas/core/resample.py:1109:            and len(self.grouper.binlabels) > len(ax)  # type: ignore[attr-defined]
pandas/core/config_init.py:332:        ip = get_ipython()  # type: ignore[name-defined]
pandas/core/computation/pytables.py:88:    @property  # type: ignore[misc]
pandas/core/computation/ops.py:89:        supr_new = super(Term, klass).__new__  # type: ignore[misc]
pandas/core/computation/ops.py:610:        operands = [op(env) for op in self.operands]  # type: ignore[operator]
pandas/core/computation/expr.py:677:                f"Invalid function call {node.func.id}"  # type: ignore[attr-defined]
pandas/core/computation/expr.py:701:                        "keyword error in function call "  # type: ignore[attr-defined]
pandas/core/computation/expressions.py:241:            return _evaluate(op, op_str, a, b)  # type: ignore[misc]
pandas/core/computation/scope.py:136:            self.scope = self.scope.new_child(  # type: ignore[assignment]
pandas/core/computation/scope.py:142:                self.scope = self.scope.new_child(  # type: ignore[assignment]
pandas/core/computation/scope.py:151:            resolvers += tuple(local_dict.resolvers.maps)  # type: ignore[has-type]
pandas/core/computation/scope.py:239:                mapping[new_key] = new_value  # type: ignore[index]
pandas/core/computation/scope.py:260:                self.scope = self.scope.new_child(d)  # type: ignore[assignment]
pandas/core/computation/scope.py:333:            + self.resolvers.maps  # type: ignore[operator]
pandas/core/computation/scope.py:334:            + self.scope.maps  # type: ignore[operator]
pandas/compat/pickle_compat.py:74:    def __new__(cls) -> Series:  # type: ignore[misc]
pandas/compat/pickle_compat.py:92:    def __new__(cls) -> DataFrame:  # type: ignore[misc]
pandas/compat/pickle_compat.py:191:class Unpickler(pkl._Unpickler):  # type: ignore[name-defined]
pandas/plotting/_matplotlib/core.py:608:                    self.legend_handles = reversed(  # type: ignore[assignment]
pandas/plotting/_matplotlib/core.py:614:                    self.legend_labels = reversed(  # type: ignore[assignment]
pandas/plotting/_matplotlib/core.py:708:                args = (x, y)  # type: ignore[assignment]
pandas/plotting/_matplotlib/core.py:1161:            plotf = self._plot  # type: ignore[assignment]
pandas/plotting/_matplotlib/core.py:1611:                blabels = None  # type: ignore[assignment]
pandas/plotting/_matplotlib/timeseries.py:68:            series.index = series.index.asfreq(  # type: ignore[attr-defined]
pandas/plotting/_matplotlib/timeseries.py:248:            weekdays = np.unique(index.dayofweek)  # type: ignore[attr-defined]
pandas/plotting/_misc.py:534:        self.__init__()  # type: ignore[misc]
pandas/io/formats/excel.py:632:                gen2 = (  # type: ignore[assignment]
pandas/io/formats/excel.py:838:            writer = ExcelWriter(  # type: ignore[abstract]
pandas/io/formats/printing.py:507:    return head, tail  # type: ignore[return-value]
pandas/io/formats/printing.py:532:        attrs.append(("dtype", f"'{obj.dtype}'"))  # type: ignore[attr-defined]
pandas/io/formats/printing.py:535:        attrs.append(("name", default_pprint(obj.name)))  # type: ignore[attr-defined]
pandas/io/formats/printing.py:538:        obj.names  # type: ignore[attr-defined]
pandas/io/formats/printing.py:541:        attrs.append(("names", default_pprint(obj.names)))  # type: ignore[attr-defined]
pandas/io/formats/console.py:73:        return __IPYTHON__ or check_main()  # type: ignore[name-defined]
pandas/io/formats/console.py:88:        ip = get_ipython()  # type: ignore[name-defined]
pandas/io/formats/style.py:1847:        class MyStyler(cls):  # type:ignore[valid-type,misc]
pandas/io/formats/csvs.py:252:                handles.handle,  # type: ignore[arg-type]
pandas/io/formats/xml.py:278:                handles.handle.write(xml_doc)  # type: ignore[arg-type]
pandas/io/formats/format.py:1384:                    float_format(value=v)  # type: ignore[operator,call-arg]
pandas/io/pytables.py:2362:        itemsize = dtype.itemsize  # type: ignore[attr-defined]
pandas/io/pytables.py:3440:        return dict(d1 + d2 + d3)  # type: ignore[operator]
pandas/io/pytables.py:4025:            blocks = list(mgr.blocks)  # type: ignore[union-attr]
pandas/io/pytables.py:4029:                blocks.extend(mgr.blocks)  # type: ignore[union-attr]
pandas/io/pickle.py:107:                pickle.dumps(obj, protocol=protocol)  # type: ignore[arg-type]
pandas/io/pickle.py:112:                obj, handles.handle, protocol=protocol  # type: ignore[arg-type]
pandas/io/pickle.py:207:                    return pickle.load(handles.handle)  # type: ignore[arg-type]
pandas/io/excel/_base.py:927:            for extension in cls.supported_extensions  # type: ignore[attr-defined]
pandas/io/excel/_base.py:1003:        zf = zipfile.ZipFile(stream)  # type: ignore[arg-type]
pandas/io/stata.py:914:        self.TYPE_MAP = list(range(251)) + list("bhlfd")  # type: ignore[arg-type]
pandas/io/stata.py:1094:            self.path_or_buf = BytesIO(handles.handle.read())  # type: ignore[arg-type]
pandas/io/stata.py:2211:            to_write.encode(self._encoding)  # type: ignore[arg-type]
pandas/io/stata.py:2218:        self.handles.handle.write(value)  # type: ignore[arg-type]
pandas/io/stata.py:2542:            self.handles.handle.write(bio.getvalue())  # type: ignore[arg-type]
pandas/io/json/_json.py:1045:            )  # type:ignore[misc]
pandas/io/common.py:518:    )  # type: ignore[operator]
pandas/io/common.py:628:                    fileobj=handle,  # type: ignore[arg-type]
pandas/io/common.py:636:                handle,  # type: ignore[arg-type]
pandas/io/common.py:693:            handle,  # type: ignore[arg-type]
pandas/io/common.py:731:class _BytesZipFile(zipfile.ZipFile, BytesIO):  # type: ignore[misc]
pandas/io/common.py:755:        super().__init__(file, mode, **kwargs_zip)  # type: ignore[arg-type]
pandas/io/common.py:852:        wrapped = cast(mmap.mmap, _MMapWrapper(handle))  # type: ignore[arg-type]
pandas/io/parsers/c_parser_wrapper.py:48:            self.handles.handle = self.handles.handle.mmap  # type: ignore[union-attr]
pandas/io/parsers/readers.py:976:        return mapping[engine](self.f, **self.options)  # type: ignore[call-arg]
pandas/io/parsers/python_parser.py:243:        self.data = reader  # type: ignore[assignment]
pandas/io/parsers/python_parser.py:301:            size = self.chunksize  # type: ignore[attr-defined]

@simonjayhawkins simonjayhawkins added good first issue Typing type annotations, mypy/pyright type checking labels Nov 9, 2020
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Nov 9, 2020
@Praveenk8051
Copy link

Hello, I'm contributing for the first time to OSS. Can i try this one ?

@simonjayhawkins
Copy link
Member Author

@Praveenk8051 some fixes will be easier than others. anyone is welcome to take a look at addressing any of these mypy errors.

@Praveenk8051
Copy link

Thank you. I will go through the development documentation and then jump into the issue

@sidram05
Copy link

Hi @simonjayhawkins / @Praveenk8051 do you guys need more help ?
One of my first OSS projects as well, willing to help!

@simonjayhawkins
Copy link
Member Author

@sidram05 sure. #37715 (comment)

some fixes will be easier than others. anyone is welcome to take a look at addressing any of these mypy errors.

@Praveenk8051
Copy link

@sidram05 I'm not working on this. I'm working on different issue

@Praveenk8051
Copy link

@sidram05 Are you working on this ?

@phofl
Copy link
Member

phofl commented Dec 9, 2020

 pandas/io/parsers.py:3199: or i - len(self.index_col) # type: ignore[operator]
pandas/io/parsers.py:3209: if i in self._col_indices # type: ignore[operator]

Would be fixed with #38334

@jotasi
Copy link
Contributor

jotasi commented Dec 31, 2020

pandas/io/parsers.py was already adapted in #37639. That fixed / removed the following:

  • pandas/io/parsers.py:1044: "c": CParserWrapper, # type: ignore[dict-item]
  • pandas/io/parsers.py:1048: "python": PythonParser, # type: ignore[dict-item]
  • pandas/io/parsers.py:1052: "python-fwf": FixedWidthFieldParser, # type: ignore[dict-item]
  • pandas/io/parsers.py:1411: self.handles.close() # type: ignore[attr-defined]
  • pandas/io/parsers.py:2020: x = names.index(x) # type: ignore[union-attr]
  • pandas/io/parsers.py:2118: names = list(self.orig_names) # type: ignore[arg-type]
  • pandas/io/parsers.py:2900: next(self.data) # type: ignore[arg-type]
  • pandas/io/parsers.py:2964: return next(self.data) # type: ignore[arg-type]
  • pandas/io/parsers.py:3257: new_rows.append(next(self.data)) # type: ignore[arg-type]
  • pandas/io/parsers.py:3763: self.data = FixedWidthReader( # type: ignore[assignment]

(Most (i.e. all [arg-type]s related to next(...)) are fixed by asserting that the Optional that next is called on is not None.)

In turn, it introduced:

  • pandas/io/parsers.py:1045 return mapping[engine](self.f, **self.options) # type: ignore[call-arg]

I'll try to put together a PR fixing some of the remaining in there.

@phofl
Copy link
Member

phofl commented Jan 3, 2021

#37715 (comment) is now fixed

@jreback
Copy link
Contributor

jreback commented Jan 3, 2021

updated checkboxes for #37715 (comment), #37715 (comment), #37715 (comment)

@phofl
Copy link
Member

phofl commented Sep 6, 2022

You can simply add a xref when opening your pr

@mroeschke mroeschke removed this from the Contributions Welcome milestone Oct 13, 2022
@seanjedi
Copy link
Contributor

seanjedi commented Dec 2, 2022

Is this issue resolved?
Can I also work on this issue?

@Snehaaa18
Copy link

Is this issue open? I would like to work on it

@ggold7046
Copy link
Contributor

Hi, I want to work on this issue. Can anybody guide me what to do to fix mypy error ?

@MarcoGorelli
Copy link
Member

shall we close this? the most obvious ones have been done already, it's generally not clear to people how to get started, and fixing the remaining type ignores requires a fair bit of knowledge

@MarcoGorelli MarcoGorelli added the Closing Candidate May be closeable, needs more eyeballs label Jun 26, 2023
@mroeschke
Copy link
Member

Agreed. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs good first issue Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

No branches or pull requests