-
Notifications
You must be signed in to change notification settings - Fork 80
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
MRG: adjust Signature::name()
to return Option<String>
instead of filename()
and md5sum()
#3434
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## latest #3434 +/- ##
==========================================
- Coverage 86.44% 86.42% -0.03%
==========================================
Files 137 137
Lines 16102 16106 +4
Branches 2219 2219
==========================================
- Hits 13920 13919 -1
- Misses 1875 1880 +5
Partials 307 307
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -351,7 +351,15 @@ impl RevIndexOps for RevIndex { | |||
.collection | |||
.record_for_dataset(dataset_id) | |||
.expect("dataset not found"); | |||
Some((row.name().into(), size)) | |||
|
|||
let mut name = row.name(); |
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 is ugly - is there an idiomatic way to do this??
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.
maybe?
let name = [row.name(), row.filename(), row.md5()]
.into_iter()
.skip_while(|v| v.is_empty())
.next()
.unwrap(); // guaranteed to succeed because `md5` always exists
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.
yeh.... :)
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.
in 0ed80c1
Signature::name()
return empty string if name is None
Signature::name()
return empty string if name is None
@luizirber @bluegenes ready for review! |
src/core/src/signature.rs
Outdated
@@ -448,10 +448,8 @@ impl Signature { | |||
pub fn name(&self) -> String { |
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.
since r0.18.0
is not released yet, do we want to make this
pub fn name(&self) -> Option<String> {
instead? This wil change calls around in other places, but seems to communicate better that the name exists or not instead of getting a .name()
call that might return ""
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.
ooh, I like it! let me give it a try 🙇
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.
Signature::name()
return empty string if name is None
Signature::name()
to return Option<String>
instead of filename()
and md5sum()
ready for review @luizirber ! |
## [0.18.0] - 2024-12-20 MSRV: 1.66 Changes/additions: * add skipmer capacity to sourmash python layer via ffi (#3446) * add skipmers; switch to reading frame approach for translation, skipmers (#3395) * Refactor: Use to_writer/from_reader across the codebase (#3443) * adjust `Signature::name()` to return `Option<String>` instead of `filename()` and `md5sum()` (#3434) * propagate zipfile errors (#3431) Updates: * Bump proptest from 1.5.0 to 1.6.0 (#3437) * Bump roaring from 0.10.8 to 0.10.9 (#3438) * Bump serde from 1.0.215 to 1.0.216 (#3436) * Bump statrs from 0.17.1 to 0.18.0 (#3426) * Bump roaring from 0.10.7 to 0.10.8 (#3423) * Bump needletail from 0.6.0 to 0.6.1 (#3427) * Bump web-sys from 0.3.72 to 0.3.74 (#3411) * Bump js-sys from 0.3.72 to 0.3.74 (#3412) * Bump roaring from 0.10.6 to 0.10.7 (#3413) * Bump serde_json from 1.0.132 to 1.0.133 (#3402) * Bump serde from 1.0.214 to 1.0.215 (#3403)
Release issue: #3481 ---- NOTE: This release adds basic support for skipmers, but they are not yet fully supported. Minor new features: * add genbank plant db to docs (#3429) * add skipmer capacity to sourmash python layer via ffi (#3446) * add skipmers; switch to reading frame approach for translation, skipmers (#3395) * additional moltype specification needed for `sig downsample` with skipmers (#3457) * update with misc animal genomes (#3422) Cleanup and documentation updates: * add comment about semver and column headings (#3433) Developer updates: * Deps: update to rocksdb 0.23 (#3456) * Refactor: Use to_writer/from_reader across the codebase (#3443) * adjust `Signature::name()` to return `Option<String>` instead of `filename()` and `md5sum()` (#3434) * bump version to 4.8.13-dev (#3474) * fix comment in _set_num_scaled (#3451) * propagate zipfile errors (#3431) * update rust CHANGELOG in preparation for r0.18.0 (#3450) * CI: github actions updates (#3476) Dependabot updates: * Bump itertools from 0.13.0 to 0.14.0 (#3471) * Bump needletail from 0.6.0 to 0.6.1 (#3427) * Bump proptest from 1.5.0 to 1.6.0 (#3437) * Bump roaring from 0.10.7 to 0.10.8 (#3423) * Bump roaring from 0.10.8 to 0.10.9 (#3438) * Bump serde from 1.0.215 to 1.0.216 (#3436) * Bump serde from 1.0.216 to 1.0.217 (#3464) * Bump serde_json from 1.0.133 to 1.0.134 (#3453) * Bump statrs from 0.17.1 to 0.18.0 (#3426) * Bump tempfile from 3.14.0 to 3.15.0 (#3472) * Bump thiserror from 2.0.3 to 2.0.6 (#3425) * Bump thiserror from 2.0.6 to 2.0.7 (#3435) * Bump thiserror from 2.0.7 to 2.0.8 (#3448) * Bump thiserror from 2.0.8 to 2.0.9 (#3452) * Update maturin requirement from <1.8.0,>=1 to >=1,<1.9.0 (#3465) * [pre-commit.ci] pre-commit autoupdate (#3428) * [pre-commit.ci] pre-commit autoupdate (#3439) * [pre-commit.ci] pre-commit autoupdate (#3454) * [pre-commit.ci] pre-commit autoupdate (#3473)
This PR adjusts
Signature::name()
to returnNone
when no name is set, instead of returning firstfilename()
or (if empty)md5sum()
. It also addsname_str()
which returns an empty string, to avoid too manyunwrap_or
scattered throughout the codebase.Fixes #3441