This will allow deduplicating code across loaders.
Details
- Reviewers
olasd - Group Reviewers
Reviewers - Commits
- rDMODa5a9f57c4dcd: Add classmethod Person.from_address, to parse from 'name <email>' strings.
Diff Detail
- Repository
- rDMOD Data model
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 10834 Build 16275: tox-on-jenkins Jenkins Build 16274: arc lint + arc unit
Event Timeline
Build is green
See https://jenkins.softwareheritage.org/job/DMOD/job/tox/200/ for more details.
swh/model/model.py | ||
---|---|---|
92 | I guess it's really a fullname rather than an address. Please add some documentation. Notably, please mention that
| |
99–100 | How many users actually need this? I'm a bit worried about the str/bytes dual support bubbling up to callers, and I'd really prefer for the str operation to be an explicit request, that is, either having a from_fullname_str function, or having the callers call .encode() themselves. | |
110–115 | At that point, as we never guarantee that name/email and fullname can round-trip, we should probably just strip() the contents of the full name and the email. Of course that's introducing a subtle change of behavior everywhere, which isn't /great/. | |
118 | Probably should use rindex (i.e. find the last closing bracket). |
I think you should simply reuse the parse_author function that you removed in D2743.
It handles a lot of author strings format and is properly tested.
Its purpose was to handle all the weird things that you can find in package.json files in the wild.
swh/model/model.py | ||
---|---|---|
99–100 | I copy-pasted this from the git loader, which probably doesn't need it. |
Build is green
See https://jenkins.softwareheritage.org/job/DMOD/job/tox/207/ for more details.
The goal is to phase out name and email from the model/storage and push it to frontends, and this is the simplest way to preserve compatibility with non-NPM sources in case there are parentheses in the name.
Build is green
See https://jenkins.softwareheritage.org/job/DMOD/job/tox/208/ for more details.