knify 1.8.46__tar.gz → 1.8.48__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {knify-1.8.46 → knify-1.8.48}/PKG-INFO +1 -1
- {knify-1.8.46 → knify-1.8.48}/knify/dateutil.py +4 -0
- knify-1.8.48/knify/fileutil.py +13 -0
- {knify-1.8.46 → knify-1.8.48}/knify/help.py +1 -1
- {knify-1.8.46 → knify-1.8.48}/knify.egg-info/PKG-INFO +1 -1
- knify-1.8.46/knify/fileutil.py +0 -13
- {knify-1.8.46 → knify-1.8.48}/LICENSE +0 -0
- {knify-1.8.46 → knify-1.8.48}/README.md +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify/__init__.py +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify/listutil.py +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify/logger.py +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify/objutil.py +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify/threadutil.py +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify/warnutil.py +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify.egg-info/SOURCES.txt +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify.egg-info/dependency_links.txt +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify.egg-info/requires.txt +0 -0
- {knify-1.8.46 → knify-1.8.48}/knify.egg-info/top_level.txt +0 -0
- {knify-1.8.46 → knify-1.8.48}/setup.cfg +0 -0
- {knify-1.8.46 → knify-1.8.48}/setup.py +0 -0
@@ -14,6 +14,10 @@ def now() -> datetime:
|
|
14
14
|
return datetime.datetime.now()
|
15
15
|
|
16
16
|
|
17
|
+
def now_str(format: str = FORMAT_YYMMDDHMS) -> str:
|
18
|
+
return date_to_str(now(), format)
|
19
|
+
|
20
|
+
|
17
21
|
def date_to_str(date_obj: datetime, format: str = FORMAT_YYMMDDHMS) -> str:
|
18
22
|
if type(date_obj) == datetime.timedelta:
|
19
23
|
return (datetime.datetime(1970, 1, 1) + date_obj).strftime(format)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding:utf-8 -*-
|
3
|
+
# Author: qicongsheng
|
4
|
+
|
5
|
+
|
6
|
+
def read_to_string(file_path: str, encoding: str = 'utf-8') -> str:
|
7
|
+
with open(file_path, 'r', encoding=encoding) as file:
|
8
|
+
return file.read()
|
9
|
+
|
10
|
+
|
11
|
+
def read_lines(file_path: str, encoding: str = 'utf-8', trim: bool = True) -> list[str]:
|
12
|
+
with open(file_path, 'r', encoding=encoding) as file:
|
13
|
+
return [line_.strip() for line_ in file.readlines()] if trim else file.readlines()
|
knify-1.8.46/knify/fileutil.py
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# -*- coding:utf-8 -*-
|
3
|
-
# Author: qicongsheng
|
4
|
-
|
5
|
-
|
6
|
-
def read_to_string(file_path_: str, encoding_: str = 'utf-8') -> str:
|
7
|
-
with open(file_path_, 'r', encoding=encoding_) as file:
|
8
|
-
return file.read()
|
9
|
-
|
10
|
-
|
11
|
-
def read_lines(file_path_: str, encoding_: str = 'utf-8', trim: bool = True) -> list[str]:
|
12
|
-
with open(file_path_, 'r', encoding=encoding_) as file:
|
13
|
-
return [line_.strip() for line_ in file.readlines()] if trim else file.readlines()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|