Skip to content
Snippets Groups Projects
  1. Dec 08, 2021
  2. Dec 07, 2021
  3. Dec 06, 2021
  4. Dec 01, 2021
  5. Nov 05, 2021
    • vlorentz's avatar
      Give model and swhid objects a nicer repr() · 2ffe5dba
      vlorentz authored
      1. hashes are now repr()ed as `hash_to_bytes("1234...")` instead of b"\x12\x34..."`
      2. SWHID objects are now repr()ed as `CoreSWHID.from_string('swh:1:...:1234...')`
         instead of `CoreSWHID(scheme='swh', version='1', object_type=..., object_id=b'\x12\x34')`
      3. enums are now repr()ed as `MyEnum.NAME` instead of "<MyEnum.NAME: 'value'>`
      
      Thanks to these three changes, using repr() on a model object now prints
      a string that can be pasted directly in a `.py` file to write a new
      test case.
      2ffe5dba
  6. Oct 01, 2021
    • vlorentz's avatar
      type_validator: Re-allow subclasses · 916627e1
      vlorentz authored
      The previous replaced attrs-strict's type validator with our own,
      stricter and faster, validator.
      
      However, the strictness can be a burden in other packages;
      for example, swh-storage tests rely on it to insert dummy data that raises
      exception when accessed, and it would be hard to do while using the exact
      expected type.
      
      This commit reverts the strict behavior, but keeps the performance
      optimization, by always checking with type equality, but in case type
      equality fails (which would raise an error before this commit), it gives
      the value a 'second chance', by trying isinstance.
      
      This means that, outside tests, isinstance should not be used at all,
      or very rarely.
      916627e1
  7. Sep 28, 2021
    • vlorentz's avatar
      model: Replace attrs-strict with stricter validation · 734b0812
      vlorentz authored
      This reimplements attrs_strict.type_validator(), using type equality
      instead of isinstance.
      
      This makes my checksum validation script (that mostly just instantiates
      model objects, computes a checksum, then discard) run twice as fast.
      734b0812
  8. Sep 24, 2021
  9. Sep 23, 2021
  10. Sep 16, 2021
  11. Jul 27, 2021
  12. Jul 23, 2021
    • Nicolas Dandrimont's avatar
      Add an extid_version field to ExtIDs · 1545ef77
      Nicolas Dandrimont authored
      This allows distinguishing multiple potential versions of the mapping
      between external objects and their counterparts archived in Software
      Heritage, for instance when a loader has a backwards-incompatible change
      that should result in objects being loaded again.
      
      The field defaults to zero, in which case it's backwards-compatible with
      the previous implementation in terms of identifier computation.
      v2.7.0
      1545ef77
  13. Jul 02, 2021
  14. Jun 25, 2021
  15. Jun 21, 2021
  16. Jun 15, 2021
  17. Jun 11, 2021
Loading