From 69b627358db6ed24c0e43b5439ee977b815e084c Mon Sep 17 00:00:00 2001 From: roomrys <38435167+roomrys@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:22:55 -0800 Subject: [PATCH] Use Path instead of pathlib.Path and sort imports and remove unused imports --- sleap/gui/dataviews.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/sleap/gui/dataviews.py b/sleap/gui/dataviews.py index dfbaad496..bd99d1ecf 100644 --- a/sleap/gui/dataviews.py +++ b/sleap/gui/dataviews.py @@ -15,21 +15,17 @@ """ -from qtpy import QtCore, QtWidgets, QtGui - -import numpy as np import os -import pathlib - from operator import itemgetter +from pathlib import Path +from typing import Any, Callable, List, Optional -from typing import Any, Callable, Dict, List, Optional, Type +import numpy as np +from qtpy import QtCore, QtGui, QtWidgets -from sleap.gui.state import GuiState from sleap.gui.commands import CommandContext -from sleap.gui.color import ColorManager -from sleap.io.dataset import Labels -from sleap.instance import LabeledFrame, Instance +from sleap.gui.state import GuiState +from sleap.instance import LabeledFrame from sleap.skeleton import Skeleton @@ -401,10 +397,10 @@ def item_to_data(self, obj, item: "Video"): for property in self.properties: if property == "name": filename = getattr(item, "filename") - data[property] = pathlib.Path(filename).name + data[property] = Path(filename).name elif property == "filepath": filename = getattr(item, "filename") - data[property] = str(pathlib.Path(filename).parent) + data[property] = str(Path(filename).parent) else: data[property] = getattr(item, property) return data