Skip to content

Commit 6d46996

Browse files
Apply ruff/refurb rule FURB118
FURB118 Use `operator.itemgetter(slice(7))` instead of defining a function
1 parent d37c280 commit 6d46996

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/setuptools_scm/git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import dataclasses
44
import logging
5+
import operator
56
import os
67
import re
78
import shlex
@@ -144,8 +145,7 @@ def fetch_shallow(self) -> None:
144145
run_git(["fetch", "--unshallow"], self.path, check=True, timeout=240)
145146

146147
def node(self) -> str | None:
147-
def _unsafe_short_node(node: str) -> str:
148-
return node[:7]
148+
_unsafe_short_node = operator.itemgetter(slice(7))
149149

150150
return run_git(
151151
["rev-parse", "--verify", "--quiet", "HEAD"], self.path

0 commit comments

Comments
 (0)