-
Notifications
You must be signed in to change notification settings - Fork 12
Inherit list_of(raw()) #11
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
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
864260d
- Use _vctrs_. Only the user-facing `blob()` constructor checks the c…
krlmlr 28856a1
Get rid of print() method
krlmlr d111652
Implement vec_ptype_abbr() instead of type_sum()
krlmlr ec2b752
Extract check_raw_list()
krlmlr 16cc4af
Comment reasons for existing behavior
krlmlr b57ab6f
- blob() uses tidy evaluation.
krlmlr 4cfc28b
- new_blob() gains default argument for convenience.
krlmlr 3d63f63
Casting and coercion, [<- and c methods now gone.
krlmlr 1ff83a9
is.na() works out of the box, is.na<-() needs to be kept for now
krlmlr 6700523
- Simplify .
krlmlr 8a4acf9
Add tests
krlmlr 2df1350
- Use vec_cast() to implement as.blob().
krlmlr 270a163
Add lifecycle compat code
krlmlr 581212a
as_blob() and is_blob()
krlmlr 4fbfa51
Proper abbreviations
krlmlr a9e4ece
Use s3_register()
krlmlr 0715ff1
Remove vctrs_blob class
krlmlr c67c462
Use vctrs_list_of
krlmlr 8926932
Remove [[<-
krlmlr 5e3514e
- Deprecate as_blob.integer().
krlmlr 3e81ecb
Remove is.na<-()
krlmlr 140c995
Add tests
krlmlr 059f9a3
Final tweaks
krlmlr 1212c24
Add remote
krlmlr c156727
Declare crayon dependency
krlmlr 40259ee
Document params
krlmlr 309b71f
Use dev version of vctrs
krlmlr a25a861
Merge branch 'master' into f-vctrs
krlmlr a0d96db
Printing
krlmlr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
S3method("[",blob) | ||
S3method("[<-",blob) | ||
S3method("[[<-",blob) | ||
S3method("is.na<-",blob) | ||
S3method(as.blob,blob) | ||
S3method(as.blob,character) | ||
S3method(as.blob,integer) | ||
S3method(as.blob,list) | ||
S3method(as.blob,raw) | ||
S3method(as.data.frame,blob) | ||
S3method(c,blob) | ||
S3method(as.blob,default) | ||
S3method(format,blob) | ||
S3method(is.na,blob) | ||
S3method(print,blob) | ||
S3method(obj_print_data,blob) | ||
S3method(vec_cast,blob) | ||
S3method(vec_cast.blob,blob) | ||
S3method(vec_cast.blob,character) | ||
S3method(vec_cast.blob,default) | ||
S3method(vec_cast.blob,integer) | ||
S3method(vec_cast.blob,list) | ||
S3method(vec_cast.blob,logical) | ||
S3method(vec_cast.blob,raw) | ||
S3method(vec_cast.list,blob) | ||
S3method(vec_ptype_abbr,blob) | ||
S3method(vec_ptype_full,blob) | ||
S3method(vec_type2,blob) | ||
S3method(vec_type2.blob,blob) | ||
S3method(vec_type2.blob,default) | ||
S3method(vec_type2.blob,list) | ||
S3method(vec_type2.blob,vctrs_unspecified) | ||
S3method(vec_type2.list,blob) | ||
export(as.blob) | ||
export(as_blob) | ||
export(blob) | ||
export(is_blob) | ||
export(new_blob) | ||
export(vec_cast.blob) | ||
export(vec_type2.blob) | ||
import(rlang) | ||
import(vctrs) | ||
importFrom(methods,setOldClass) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#' Casting | ||
#' | ||
#' Double dispatch methods to support [vctrs::vec_cast()]. | ||
#' | ||
#' @inheritParams vctrs::vec_cast | ||
#' | ||
krlmlr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#' @method vec_cast blob | ||
#' @export | ||
#' @export vec_cast.blob | ||
vec_cast.blob <- function(x, to) UseMethod("vec_cast.blob") | ||
|
||
#' @method vec_cast.blob default | ||
#' @export | ||
vec_cast.blob.default <- function(x, to) stop_incompatible_cast(x, to) | ||
|
||
#' @method vec_cast.blob logical | ||
#' @export | ||
vec_cast.blob.logical <- function(x, to) vec_unspecified_cast(x, to) | ||
|
||
#' @method vec_cast.blob blob | ||
#' @export | ||
vec_cast.blob.blob <- function(x, to) x | ||
|
||
#' @method vec_cast.blob list | ||
#' @export | ||
vec_cast.blob.list <- function(x, to) blob(!!!x) | ||
krlmlr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#' @method vec_cast.blob integer | ||
#' @export | ||
vec_cast.blob.integer <- function(x, to) { | ||
warn_deprecated("Coercing an integer vector to a blob is deprecated, please coerce to a list first.") | ||
blob(!!!lapply(x, as_single_raw)) | ||
} | ||
|
||
#' @method vec_cast.blob raw | ||
#' @export | ||
vec_cast.blob.raw <- function(x, to) blob(x) | ||
|
||
#' @method vec_cast.blob character | ||
#' @export | ||
vec_cast.blob.character <- function(x, to) blob(!!!lapply(x, charToRaw)) | ||
|
||
#' @method vec_cast.list blob | ||
#' @export | ||
vec_cast.list.blob <- function(x, to) vec_data(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#' Coercion | ||
#' | ||
#' Double dispatch methods to support [vctrs::vec_type2()]. | ||
#' | ||
#' @inheritParams vctrs::vec_type2 | ||
#' | ||
#' @method vec_type2 blob | ||
#' @export | ||
#' @export vec_type2.blob | ||
vec_type2.blob <- function(x, y) UseMethod("vec_type2.blob", y) | ||
|
||
#' @method vec_type2.blob default | ||
#' @export | ||
vec_type2.blob.default <- function(x, y) stop_incompatible_type(x, y) | ||
|
||
#' @method vec_type2.blob blob | ||
#' @export | ||
vec_type2.blob.blob <- function(x, y) { | ||
new_blob(list()) | ||
} | ||
|
||
#' @method vec_type2.blob vctrs_unspecified | ||
#' @export | ||
vec_type2.blob.vctrs_unspecified <- function(x, y) x | ||
|
||
#' @method vec_type2.blob list | ||
#' @export | ||
vec_type2.blob.list <- function(x, y) { | ||
check_raw_list(y) | ||
new_blob(list()) | ||
} | ||
|
||
#' @method vec_type2.list blob | ||
#' @export | ||
vec_type2.list.blob <- function(x, y) { | ||
check_raw_list(x) | ||
new_blob(list()) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.