reykit 1.1.56__py3-none-any.whl → 1.1.57__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reykit/rtext.py +26 -1
- reykit/rtime.py +51 -14
- reykit/rwrap.py +3 -3
- {reykit-1.1.56.dist-info → reykit-1.1.57.dist-info}/METADATA +1 -1
- {reykit-1.1.56.dist-info → reykit-1.1.57.dist-info}/RECORD +7 -7
- {reykit-1.1.56.dist-info → reykit-1.1.57.dist-info}/WHEEL +0 -0
- {reykit-1.1.56.dist-info → reykit-1.1.57.dist-info}/licenses/LICENSE +0 -0
reykit/rtext.py
CHANGED
@@ -26,7 +26,8 @@ __all__ = (
|
|
26
26
|
'frame_text',
|
27
27
|
'frame_data',
|
28
28
|
'join_data_text',
|
29
|
-
'join_filter_text'
|
29
|
+
'join_filter_text',
|
30
|
+
'is_zh'
|
30
31
|
)
|
31
32
|
|
32
33
|
|
@@ -516,3 +517,27 @@ def join_filter_text(data: Iterable, char: str = ',', filter_: tuple = (None, ''
|
|
516
517
|
text = char.join(data)
|
517
518
|
|
518
519
|
return text
|
520
|
+
|
521
|
+
|
522
|
+
def is_zh(char: str) -> bool:
|
523
|
+
"""
|
524
|
+
whther is Chinese character.
|
525
|
+
Only includes basic Chinese character.
|
526
|
+
|
527
|
+
Parameters
|
528
|
+
----------
|
529
|
+
char : One character.
|
530
|
+
|
531
|
+
Returns
|
532
|
+
-------
|
533
|
+
Judged result.
|
534
|
+
"""
|
535
|
+
|
536
|
+
# Check.
|
537
|
+
if len(char) != 1:
|
538
|
+
throw(ValueError, char)
|
539
|
+
|
540
|
+
# Judge.
|
541
|
+
judge = '\u4e00' <= char <= '\u9fa5'
|
542
|
+
|
543
|
+
return judge
|
reykit/rtime.py
CHANGED
@@ -516,7 +516,7 @@ class TimeMark(Base):
|
|
516
516
|
"""
|
517
517
|
|
518
518
|
# Record table.
|
519
|
-
self.
|
519
|
+
self.records: dict[int, RecordData] = {}
|
520
520
|
|
521
521
|
|
522
522
|
def mark(self, note: str | None = None) -> int:
|
@@ -535,7 +535,7 @@ class TimeMark(Base):
|
|
535
535
|
# Get parametes.
|
536
536
|
|
537
537
|
# Mark.
|
538
|
-
index = len(self.
|
538
|
+
index = len(self.records)
|
539
539
|
now_timestamp = now('timestamp')
|
540
540
|
now_datetime = now('datetime')
|
541
541
|
record = {
|
@@ -548,11 +548,11 @@ class TimeMark(Base):
|
|
548
548
|
## Not first.
|
549
549
|
if index != 0:
|
550
550
|
last_index = index - 1
|
551
|
-
last_datetime = self.
|
551
|
+
last_datetime = self.records[last_index]['datetime']
|
552
552
|
record['timedelta'] = now_datetime - last_datetime
|
553
553
|
|
554
554
|
## Record.
|
555
|
-
self.
|
555
|
+
self.records[index] = record
|
556
556
|
|
557
557
|
return index
|
558
558
|
|
@@ -576,14 +576,14 @@ class TimeMark(Base):
|
|
576
576
|
from pandas import DataFrame
|
577
577
|
|
578
578
|
# Handle parameter.
|
579
|
-
record_len = len(self.
|
579
|
+
record_len = len(self.records)
|
580
580
|
data = [
|
581
581
|
info.copy()
|
582
|
-
for info in self.
|
582
|
+
for info in self.records.values()
|
583
583
|
]
|
584
584
|
indexes = [
|
585
585
|
index
|
586
|
-
for index in self.
|
586
|
+
for index in self.records
|
587
587
|
]
|
588
588
|
|
589
589
|
# Generate report.
|
@@ -598,7 +598,7 @@ class TimeMark(Base):
|
|
598
598
|
if record_len > 2:
|
599
599
|
row: RecordData = dict.fromkeys(('timestamp', 'datetime', 'timedelta', 'note'))
|
600
600
|
max_index = record_len - 1
|
601
|
-
total_timedelta = self.
|
601
|
+
total_timedelta = self.records[max_index]['datetime'] - self.records[0]['datetime']
|
602
602
|
row['timedelta'] = total_timedelta
|
603
603
|
data.append(row)
|
604
604
|
indexes.append('total')
|
@@ -640,13 +640,13 @@ class TimeMark(Base):
|
|
640
640
|
"""
|
641
641
|
|
642
642
|
# Break.
|
643
|
-
if len(self.
|
643
|
+
if len(self.records) <= 1:
|
644
644
|
return 0.0
|
645
645
|
|
646
646
|
# Handle parameter.
|
647
|
-
first_timestamp = self.
|
648
|
-
max_index = max(self.
|
649
|
-
last_timestamp = self.
|
647
|
+
first_timestamp = self.records[0]['timestamp']
|
648
|
+
max_index = max(self.records)
|
649
|
+
last_timestamp = self.records[max_index]['timestamp']
|
650
650
|
|
651
651
|
# Calculate.
|
652
652
|
seconds = round((last_timestamp - first_timestamp) / 1000, 3)
|
@@ -654,6 +654,15 @@ class TimeMark(Base):
|
|
654
654
|
return seconds
|
655
655
|
|
656
656
|
|
657
|
+
def clear(self) -> None:
|
658
|
+
"""
|
659
|
+
Clear records.
|
660
|
+
"""
|
661
|
+
|
662
|
+
# Clear.
|
663
|
+
self.records.clear()
|
664
|
+
|
665
|
+
|
657
666
|
def __str__(self) -> str:
|
658
667
|
"""
|
659
668
|
Convert to string.
|
@@ -672,6 +681,34 @@ class TimeMark(Base):
|
|
672
681
|
return string
|
673
682
|
|
674
683
|
|
675
|
-
|
684
|
+
def __int__(self) -> int:
|
685
|
+
"""
|
686
|
+
Get total spend seconds, truncate the decimal part.
|
687
|
+
|
688
|
+
Returns
|
689
|
+
-------
|
690
|
+
Total spend seconds.
|
691
|
+
"""
|
692
|
+
|
693
|
+
# Get
|
694
|
+
total_speend = int(self.total_spend)
|
695
|
+
|
696
|
+
return total_speend
|
676
697
|
|
677
|
-
|
698
|
+
|
699
|
+
def __float__(self) -> float:
|
700
|
+
"""
|
701
|
+
Get total spend seconds.
|
702
|
+
|
703
|
+
Returns
|
704
|
+
-------
|
705
|
+
Total spend seconds.
|
706
|
+
"""
|
707
|
+
|
708
|
+
# Get
|
709
|
+
total_speend = self.total_spend
|
710
|
+
|
711
|
+
return total_speend
|
712
|
+
|
713
|
+
|
714
|
+
__call__ = __getitem__ = mark
|
reykit/rwrap.py
CHANGED
@@ -197,9 +197,9 @@ def wrap_runtime(
|
|
197
197
|
tm()
|
198
198
|
|
199
199
|
# Generate report.
|
200
|
-
start_time = tm.
|
201
|
-
spend_time: Timedelta = tm.
|
202
|
-
end_time = tm.
|
200
|
+
start_time = tm.records[0]['datetime']
|
201
|
+
spend_time: Timedelta = tm.records[1]['timedelta']
|
202
|
+
end_time = tm.records[1]['datetime']
|
203
203
|
start_str = time_to(start_time, True)[:-3]
|
204
204
|
spend_str = time_to(spend_time, True)[:-3]
|
205
205
|
end_str = time_to(end_time, True)[:-3]
|
@@ -16,13 +16,13 @@ reykit/rstdout.py,sha256=yesWo7wIGablpyAu-2J2Gw11Qp3GdQjGICTyIcvLyt4,8200
|
|
16
16
|
reykit/rsys.py,sha256=cafnGGerxR0kg5GHNJojmvsMDNsjgsJ3CtIGH5mAJa8,24953
|
17
17
|
reykit/rtable.py,sha256=YuDH2GL9Lwr5LljRDm5hzHrsvaXOs4-X89XVwFD-b0g,12221
|
18
18
|
reykit/rtask.py,sha256=d3Fs-_ZB-uHtzz7zyI2aAmiQv3NcIvWrco6x10jFuzc,22842
|
19
|
-
reykit/rtext.py,sha256=
|
20
|
-
reykit/rtime.py,sha256=
|
21
|
-
reykit/rwrap.py,sha256=
|
19
|
+
reykit/rtext.py,sha256=cWHy19lDcJvpX7LU95kmRVsDimpAUaz5TbKC1h83gB4,13254
|
20
|
+
reykit/rtime.py,sha256=8QJ6YNiC0JUDiW1xc1tkzQUMPYOFT7d7dKCYRuYt9co,17635
|
21
|
+
reykit/rwrap.py,sha256=UaMkBx3tTtFlqCGe7no6VmOIFnnuxNKcmIsAAThZUVs,15326
|
22
22
|
reykit/rzip.py,sha256=BGEONswuBZxQ-zcgd_xp2fcvYesC9AmKaaXWvnT3bTI,3456
|
23
23
|
reykit/rdll/__init__.py,sha256=nLSb8onBm2ilyoxzpDzUeGfSCKwkLEesIhzK3LiJ8mk,701
|
24
24
|
reykit/rdll/rdll_core.py,sha256=o6-rKcTQgxZQe0kD3GnwyNb3KL9IogzgCQNOmYLMm7A,5086
|
25
|
-
reykit-1.1.
|
26
|
-
reykit-1.1.
|
27
|
-
reykit-1.1.
|
28
|
-
reykit-1.1.
|
25
|
+
reykit-1.1.57.dist-info/METADATA,sha256=AAtWdfLmqVHiDdhzZHGZs5tbOLIcv1t2vl4xF5pU6GY,1872
|
26
|
+
reykit-1.1.57.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
27
|
+
reykit-1.1.57.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
28
|
+
reykit-1.1.57.dist-info/RECORD,,
|
File without changes
|
File without changes
|