optimised imports

This commit is contained in:
bacon
2024-03-14 23:56:04 +03:00
parent 3710773d7b
commit eca1f01c16
7 changed files with 67 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
import mimetypes
import os
from mimetypes import guess_type
from os import walk
class ListGenerator:
@@ -19,7 +19,7 @@ class ListGenerator:
def _lister(cls, path) -> list:
_list: list = []
try:
for f in os.walk(path):
for f in walk(path):
_list.extend(f)
break
return sorted(_list[2])
@@ -63,7 +63,7 @@ class _ListGenerationIter:
@property
def type(self) -> str:
guess = mimetypes.guess_type(f'{self._path}/{self._list[self._current_index]}')[0]
guess = guess_type(f'{self._path}/{self._list[self._current_index]}')[0]
return guess
@property