725fdaf504237190f6787dda3d72c39010a4c574,src/python/pants/engine/collection.py,Collection,__getitem__,#Collection#,37

Before Change



    def __getitem__(self, index: Union[int, slice]) -> Union[T, "Collection[T]"]:  // noqa: F811
        if isinstance(index, int):
            return self.dependencies[index]
        return self.__class__(self.dependencies[index])

    def __len__(self) -> int:
        return len(self.dependencies)

After Change


        ...

    def __getitem__(self, index: Union[int, slice]) -> Union[T, "Collection[T]"]:  // noqa: F811
        result = super().__getitem__(index)
        if isinstance(index, int):
            return cast(T, result)
        return self.__class__(cast(Tuple[T, ...], result))

    def __eq__(self, other: Any) -> bool:
        return type(self) == type(other) and super().__eq__(other)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pantsbuild/pants
Commit Name: 725fdaf504237190f6787dda3d72c39010a4c574
Time: 2020-07-26
Author: john.sirois@gmail.com
File Name: src/python/pants/engine/collection.py
Class Name: Collection
Method Name: __getitem__


Project Name: explosion/thinc
Commit Name: 3c7d4d1240103e4c06a0110b00e11b7e1002dd0e
Time: 2020-01-12
Author: honnibal+gh@gmail.com
File Name: thinc/layers/lstm.py
Class Name:
Method Name: LSTM


Project Name: explosion/thinc
Commit Name: 1b92598dbfb489fe0f7a1c9b2015db5d702be948
Time: 2020-01-28
Author: honnibal+gh@gmail.com
File Name: thinc/layers/embed.py
Class Name:
Method Name: Embed