Compare commits

..

3 Commits

Author SHA1 Message Date
ad17b905c4 修复ToolFile中SaveAsJson的一些问题 2025-11-23 20:03:44 +08:00
4ba5bfdfee 新增函数泛型注解 2025-11-06 20:37:30 +08:00
8121899d32 修复ToolFile中文件枚举函数的错误 2025-11-06 10:54:53 +08:00
2 changed files with 3 additions and 4 deletions

View File

@@ -140,7 +140,7 @@ class Architecture:
return type_ in cls._RegisteredObjects return type_ in cls._RegisteredObjects
@classmethod @classmethod
def Get(cls, type_:type) -> Any: def Get[T](cls, type_:Typen[T]) -> T:
return cls._RegisteredObjects[type_] return cls._RegisteredObjects[type_]
@classmethod @classmethod

View File

@@ -327,7 +327,7 @@ class ToolFile(BaseModel):
except: except:
pass pass
with open(self.OriginFullPath, 'w', encoding='utf-8') as f: with open(self.OriginFullPath, 'w', encoding='utf-8') as f:
json.dump(json_data, f, indent=4) json.dump(json_data, f, indent=4, ensure_ascii=False)
return self return self
def SaveAsCsv(self, csv_data:"pd.DataFrame"): def SaveAsCsv(self, csv_data:"pd.DataFrame"):
''' '''
@@ -504,12 +504,11 @@ class ToolFile(BaseModel):
return result return result
def DirWalk( def DirWalk(
self, self,
top,
topdown: bool = True, topdown: bool = True,
onerror: Optional[Callable] = None, onerror: Optional[Callable] = None,
followlinks: bool = False followlinks: bool = False
) -> Iterator[tuple[dir_name_type, list[dir_name_type], list[file_name_type]]]: ) -> Iterator[tuple[dir_name_type, list[dir_name_type], list[file_name_type]]]:
return os.walk(self.OriginFullPath, top=top, topdown=topdown, onerror=onerror, followlinks=followlinks) return os.walk(self.OriginFullPath, topdown=topdown, onerror=onerror, followlinks=followlinks)
def bool(self): def bool(self):