reykit 1.1.37__py3-none-any.whl → 1.1.38__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/ros.py CHANGED
@@ -74,33 +74,25 @@ type FileStr = FilePath | FileText | TextIOBase
74
74
  type FileBytes = FilePath | FileData | BufferedIOBase
75
75
 
76
76
 
77
- def get_md5(file: str | bytes) -> str:
77
+ def get_md5(data: str | bytes) -> str:
78
78
  """
79
- Get file MD5.
79
+ Get MD5 value.
80
80
 
81
81
  Parameters
82
82
  ----------
83
- file : File path or file bytes.
83
+ data : Data.
84
84
 
85
85
  Returns
86
86
  -------
87
- File MD5.
87
+ MD5 value.
88
88
  """
89
89
 
90
- # Get bytes.
91
- match file:
92
-
93
- ## Path.
94
- case str():
95
- rfile = File(file)
96
- file_bytes = rfile.bytes
97
-
98
- ## Bytes.
99
- case bytes() | bytearray():
100
- file_bytes = file
90
+ # Handle parameter.
91
+ if type(data) == str:
92
+ data = data.encode()
101
93
 
102
- # Calculate.
103
- hash = hashlib_md5(file_bytes)
94
+ # Get.
95
+ hash = hashlib_md5(data)
104
96
  md5 = hash.hexdigest()
105
97
 
106
98
  return md5
@@ -712,7 +704,8 @@ class File(Base):
712
704
  """
713
705
 
714
706
  # Get.
715
- file_md5 = get_md5(self.path)
707
+ file_bytes = self.bytes
708
+ file_md5 = get_md5(file_bytes)
716
709
 
717
710
  return file_md5
718
711
 
@@ -1431,7 +1424,8 @@ class TempFile(Base):
1431
1424
  """
1432
1425
 
1433
1426
  # Get.
1434
- file_md5 = get_md5(self.path)
1427
+ file_bytes = self.read()
1428
+ file_md5 = get_md5(file_bytes)
1435
1429
 
1436
1430
  return file_md5
1437
1431
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reykit
3
- Version: 1.1.37
3
+ Version: 1.1.38
4
4
  Summary: Kit method set.
5
5
  Project-URL: homepage, https://github.com/reyxbo/reykit/
6
6
  Author-email: Rey <reyxbo@163.com>
@@ -8,7 +8,7 @@ reykit/rlog.py,sha256=ykZ8tmMJtwEaAgXmtgtU3SghJG8-ArCIiw0ZawXastg,25564
8
8
  reykit/rmonkey.py,sha256=f5vA4t9R6Nz2xfTRUSo2NJ140eg9kT12eaNkKat2AGo,8140
9
9
  reykit/rnet.py,sha256=uS27Ownt9ELsjVKpGMPVN1Endc9s7z7CfIBkfE8bPMs,15033
10
10
  reykit/rnum.py,sha256=PhG4V_BkVfCJUsbpMDN1umGZly1Hsus80TW8bpyBtyY,3653
11
- reykit/ros.py,sha256=E-80r7NyLoi2VUyHTIE8Euz7JxFAwhwrdTeG00Zb-q0,40931
11
+ reykit/ros.py,sha256=xR79PnSlpHvHsoVKHWvEagreQB24N41XHq-psHQhlMI,40818
12
12
  reykit/rrand.py,sha256=9QPXCsREIu45g6WP-XN67X05kmW3cTmctn3InvqYxuY,8947
13
13
  reykit/rre.py,sha256=4DVxy28dl5zn6_II8-cgr7E2nVPH5QJIJVB4o7Vsf1A,6078
14
14
  reykit/rschedule.py,sha256=_nrfrXYxlFAKCDbM8ibTTb60zNDlHxyE310cv-A19Kw,5799
@@ -22,7 +22,7 @@ reykit/rwrap.py,sha256=RK3wlc2cd-lnAvzqzvKsS21EtCmBNTA3i8HRbaolWE4,15275
22
22
  reykit/rzip.py,sha256=ABUDLwEHQIpcvZbJE_oV78H7dik6nC7kaRz660Ro9Os,3481
23
23
  reykit/rdll/__init__.py,sha256=1VRawI2vCsLH7KK0PcBRWNc-bwseM-M05wkc_eamwJM,696
24
24
  reykit/rdll/rdll_core.py,sha256=o6-rKcTQgxZQe0kD3GnwyNb3KL9IogzgCQNOmYLMm7A,5086
25
- reykit-1.1.37.dist-info/METADATA,sha256=HTGuMy6_L6C6sxlCnglmakS0ln7LZ5mWFNAEo0TbS7I,1872
26
- reykit-1.1.37.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
- reykit-1.1.37.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
28
- reykit-1.1.37.dist-info/RECORD,,
25
+ reykit-1.1.38.dist-info/METADATA,sha256=YkpxF426vwAROyAR4KRlDdatFamEbd_FSifn6PXySIA,1872
26
+ reykit-1.1.38.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ reykit-1.1.38.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
28
+ reykit-1.1.38.dist-info/RECORD,,