Skip to content

Commit

Permalink
Replace usage of ntpath with pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed May 7, 2024
1 parent 50dc1ee commit a973635
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions komodo/symlink/suggester/release.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import datetime
import ntpath
import os
import re


def path_leaf(path):
head, tail = ntpath.split(path)
return tail or ntpath.basename(head)
from pathlib import Path


def diff_month(date_1: datetime.date, date_2: datetime.date) -> int:
Expand Down Expand Up @@ -53,9 +47,8 @@ def py_ver(self) -> str:

@staticmethod
def id_from_file_name(file_name: str):
no_ext = os.path.splitext(file_name)[0]
return path_leaf(no_ext)
return Path(file_name).stem

@staticmethod
def path_is_release(path: str) -> bool:
return ntpath.split(path)[0] == "releases"
return Path(path).parent.name == "releases"

0 comments on commit a973635

Please sign in to comment.