Page MenuHomeSoftware Heritage

deduplicate validation logic between parse_swhid() and SWHID class constructor
Closed, MigratedEdits Locked

Description

Make it faster [1] and stricter [2]

The current validation is unevenly distributed over the parse_swhid function
and the SWHID class [1]. Keeping the validation strictly within the scope of the
class sounds more in adequation with other model objects we use in the swh.model.

Note that is has been proposed to:

  • Keep a reference of the core swhid when the swhid passed as parameter is a swhid with qualifiers.
  • Encode the path qualifier value as bytes (if any)

[1] IRC discussion

[2] D4490