Skip to content

FURB118, lambda x: x[:, 0] should be itemgetter((slice(None), 0)), instead of itemgetter((:, 0)) #13508

Closed
@nasyxx

Description

@nasyxx

In refurb, FURB118, lambda x: x[:, 0] should be itemgetter((slice(None), 0)), instead of itemgetter((:, 0))

# xx.py
import numpy as np
xs = np.array([[1, 2, 3]])
xm = map(lambda x: x[:, 0], xs)
xx.py:
  3:10 FURB118 [*] Use `operator.itemgetter((:, 0))` instead of defining a lambda

I guess (:, 0) is not a valid tuple.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions