Skip to content

Commit 2fe2cf5

Browse files
committed
remove unneed arguments for speed
1 parent fe9e4ec commit 2fe2cf5

File tree

13 files changed

+42
-43
lines changed

13 files changed

+42
-43
lines changed

+stdlib/+java/file_checksum.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@
2929

3030
fclose(fid);
3131

32-
3332
end

+stdlib/+python/is_char_device.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
function y = is_char_device(file)
2-
arguments
3-
file (1,1) string
4-
end
52

63
try
74
y = py.pathlib.Path(file).is_char_device();
8-
catch
5+
catch e
6+
pythonException(e)
97
y = logical.empty;
108
end
119

+stdlib/+sys/file_checksum.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
%% SYS.FILE_CHECKSUM compute checksum of file
22
function [hash, cmd] = file_checksum(file, hash_method)
3-
arguments
4-
file (1,1) string
5-
hash_method (1,1) string
6-
end
73

84
switch lower(hash_method)
95
case {"sha-256", "sha256"}
@@ -27,7 +23,10 @@
2723

2824
[s, m] = system(cmd);
2925

30-
assert(s == 0, "failed to compute SHA256 hash of %s: %s", file, m)
26+
if s ~= 0
27+
hash = '';
28+
return
29+
end
3130

3231
switch lower(hash_method)
3332
case {"sha-256", "sha256"}

+stdlib/+sys/get_owner.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
function [o, cmd] = get_owner(file)
2-
arguments
3-
file (1,1) string
4-
end
52

63
o = '';
74

+stdlib/+sys/hard_link_count.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
% Powershell is 0, 1, or 2
44

55
function [n, cmd] = hard_link_count(file)
6-
arguments
7-
file (1,1) string
8-
end
96

107
n = [];
118

+stdlib/+sys/is_char_device.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
function [ok, cmd] = is_char_device(file)
2-
arguments
3-
file (1,1) string
4-
end
52

63
cmd = '';
74

+stdlib/+sys/is_dev_drive.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
function [y, cmd] = is_dev_drive(fpath)
2-
arguments
3-
fpath (1,1) string
4-
end
52

63
y = false;
74
cmd = '';

+stdlib/+sys/read_symlink.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
function [r, cmd] = read_symlink(file)
2-
arguments
3-
file (1,1) string
4-
end
52

63
r = string.empty;
74

+stdlib/+sys/samepath.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
function y = samepath(path1, path2)
2-
arguments
3-
path1 (1,1) string
4-
path2 (1,1) string
5-
end
62

73
y = false;
84

+stdlib/+sys/set_modtime.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
function [ok, cmd] = set_modtime(file, dt)
2-
arguments
3-
file (1,1) string
4-
dt (1,1) datetime
5-
end
62

73
ok = false;
84

5+
tiso = string(datetime(dt), "yyyy-MM-dd HH:mm:ss");
6+
97
if ispc()
10-
cmd = sprintf('pwsh -c "(Get-Item ''%s'').LastWriteTime = ''%s''"', file, string(dt, "yyyy-MM-dd HH:mm:ss"));
8+
cmd = sprintf('pwsh -c "(Get-Item ''%s'').LastWriteTime = ''%s''"', file, tiso);
119
elseif ismac()
1210
cmd = sprintf('touch -mt %s "%s"', string(dt, "yyyyMMddHHmm"), file);
1311
else

0 commit comments

Comments
 (0)