From 6d469963db306c09607caf3a48db4d6a71935b60 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 8 May 2024 20:41:46 +0200 Subject: [PATCH] Apply ruff/refurb rule FURB118 FURB118 Use `operator.itemgetter(slice(7))` instead of defining a function --- src/setuptools_scm/git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py index eb1d519a..7eccf198 100644 --- a/src/setuptools_scm/git.py +++ b/src/setuptools_scm/git.py @@ -2,6 +2,7 @@ import dataclasses import logging +import operator import os import re import shlex @@ -144,8 +145,7 @@ def fetch_shallow(self) -> None: run_git(["fetch", "--unshallow"], self.path, check=True, timeout=240) def node(self) -> str | None: - def _unsafe_short_node(node: str) -> str: - return node[:7] + _unsafe_short_node = operator.itemgetter(slice(7)) return run_git( ["rev-parse", "--verify", "--quiet", "HEAD"], self.path