-
Notifications
You must be signed in to change notification settings - Fork 15
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
rename _convert to maybe_encode #64
Conversation
* add tests for maybe_encode * ignore CRLF/LF differences
It has no practical usage except that it's conceptually right.
@@ -24,7 +24,7 @@ function savefile(file::TextFile, content) | |||
write(file.filename, string(content)) | |||
end | |||
|
|||
function query_extended(filename) | |||
function query_extended(filename::AbstractString) |
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.
Why?
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.
This function expects only string types splitext
, I added this to make sure nothing strange is passed here as a safety net.
src/fileio.jl
Outdated
# Helpers | ||
_join(x::AbstractArray{<:AbstractString}) = mapreduce(_ignore_crlf, (x,y)->x*"\n"*y, x) | ||
_sha256(x) = bytes2hex(sha256(x)) | ||
_ignore_crlf(x::AbstractString) = replace(x, "\r"=>"") |
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.
Should we just say we are ignoring \r
?
_ignore_crlf(x::AbstractString) = replace(x, "\r"=>"") | |
_ignore_linefeed(x::AbstractString) = replace(x, "\r"=>"") |
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.
I assume you're suggesting Carriage Return (\r
) instead of linefeed (\n
)?
I renamed to _ignore_CR
with additional docstring.
Co-authored-by: Lyndon White <[email protected]>
I'm merging this to avoid possible conflict and save myself some efforts from rebasing. If there're any further comments, I'll address them in future PRs. |
This is a sub PR of #61
Changes:
_convert
tomaybe_encode
maybe_encode
I'm unclear what should
maybe_encode(format"TXT", df::DataFrame)
andmaybe_encode(format"SHA256", df::DataFrame)
behave. The current behavior ismaybe_encode(fmt, string(df))
Converting it using
string
can be prune toshow
changes. Hence I suggest we do something like@oxinabox if you like this idea, I can make a PR for this change.