-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort output of S3_File.list
and Enso_File.list
#11929
Changes from 1 commit
53e4da8
21f017d
ee11a77
1780552
d151d5d
4ebf3f3
413e901
a771429
85e9ac1
cbb9fa7
f584add
d1acf61
86f8879
3eab006
46621d0
7f05c32
ce1b578
f9f9c72
cb4f970
72b045a
4cb2a19
7dede39
2b68104
b5b5ff6
1a0880a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,16 +179,15 @@ type S3_File | |
check_recursion action = if recursive then Unimplemented.throw "S3 listing with recursion is not currently implemented." else action | ||
check_directory action = if self.is_directory.not then Error.throw (Illegal_Argument.Error "Cannot `list` a non-directory." self.uri) else action | ||
|
||
results = check_directory <| check_recursion <| check_name_filter <| | ||
check_directory <| check_recursion <| check_name_filter <| | ||
if self.s3_path.bucket == "" then translate_file_errors self <| S3.list_buckets self.credentials . map bucket-> S3_File.Value (S3_Path.Value bucket "") self.credentials else | ||
pair = translate_file_errors self <| S3.read_bucket self.s3_path.bucket self.s3_path.key self.credentials delimiter=S3_Path.delimiter | ||
bucket = self.s3_path.bucket | ||
sub_folders = pair.first . map key-> | ||
S3_File.Value (S3_Path.Value bucket key) self.credentials | ||
files = pair.second . map key-> | ||
S3_File.Value (S3_Path.Value bucket key) self.credentials | ||
sub_folders + files | ||
results.sort on=.path | ||
sub_folders + files . sort on=.s3_path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this just sort There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also we could just sort on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it better to not use a comparator? I was thinking of adding a comparator for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like it sorted the files and sub-folders properly:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd still add parentheses, the precedence of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess we could do that yeah. But still I'd rely on comparing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
## ALIAS load bytes, open bytes | ||
ICON data_input | ||
|
@@ -617,11 +616,3 @@ translate_file_errors related_file result = | |
s3_path = S3_Path.Value error.bucket error.key | ||
s3_file = S3_File.Value s3_path related_file.credentials | ||
Error.throw (File_Error.Not_Found s3_file) | ||
|
||
## PRIVATE | ||
Sort S3 files by bucket and path. | ||
sort_s3_files s3_files = | ||
s3_file_sort_key s3_file = | ||
s3_path = s3_file.path | ||
[s3_path.bucket, s3.path.key] | ||
s3_files.sort on=s3_file_sort_key |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,8 @@ add_specs suite_builder setup:Cloud_Tests_Setup = suite_builder.group "Enso Clou | |
group_builder.specify "list should sort its output" <| | ||
r = Enso_File.home.list | ||
r.should_be_a Vector | ||
r . should_equal r.sort | ||
r . should_equal (r.sort on=.path) | ||
r . should_equal (r.sort on=.enso_path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. |
||
|
||
group_builder.specify "should allow to create and delete a directory" <| | ||
my_name = "my_test_dir-" + (Random.uuid.take 5) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;-)
It would be easier to change the IDE to not display
from
methods in the component browser than adding this## PRIVATE
at every conversion method occurrence.