Skip to content
Snippets Groups Projects
  1. Jan 20, 2021
  2. Jan 13, 2021
  3. Jan 04, 2021
  4. Dec 15, 2020
    • vlorentz's avatar
      model: Make all classes slotted. · 76b744e0
      vlorentz authored
      Unfortunately, sphinx (actually, autodoc) only picks up attributes if
      they fall in any of these cases:
      
      1. are enum variants
      2. are in slots
      3. are in __dict__
      4. have an annotation
      5. are found using its custom parser
      
      (see get_object_members in sphinx/ext/autodoc/importer.py)
      
      In theory, option 5 should work for us; unfortunately, autodoc only
      asks the parser the list of members with a comment.
      And it's not easy to adapt it to ask the parser for all members,
      because said parser (sphinx/pycode/parser.py) does not return the class
      qualname (aka. namespace) for members without comments.
      
      So, as I don't want to change the interface of sphinx.pycode.parser,
      this commit switches to relying on option 3, by adding __slots__ for
      all attr classes.
      
      Additionally, this might have some performance/memory improvement
      (though I did not check) and will further avoid mutation of these
      objects.
      76b744e0
  5. Nov 16, 2020
  6. Oct 27, 2020
  7. Oct 26, 2020
  8. Oct 23, 2020
  9. Oct 08, 2020
    • vlorentz's avatar
      Add a 'unique_key' method on model objects · a251df2e
      vlorentz authored
      that returns a value suitable for unicity constraints.
      
      Motivation:
      
      * this is somewhat more of a model concern than a journal/kafka
        concern IMO
      * this is one step toward adding support for non-model objects in
        KafkaJournalWriter
      
      Implementation of the unique_key methods comes from
      `swh.journal.serializers.object_key`.
      v0.7.1
      a251df2e
  10. Sep 18, 2020
  11. Sep 17, 2020
  12. Aug 25, 2020
  13. Aug 14, 2020
    • vlorentz's avatar
      model: Raise error on naive datetimes. · 6dd6acec
      vlorentz authored
      We may unknowingly pass naive datetimes to the storage through them,
      causing the underlying DB to assign them a timezone that might not match
      the actual one.
      
      It already happens in swh.model and swh.loader.package tests.
      6dd6acec
  14. Aug 07, 2020
  15. Aug 06, 2020
  16. Jul 30, 2020
  17. Jul 20, 2020
  18. Jul 07, 2020
  19. Jul 06, 2020
    • David Douard's avatar
      Extract the extra_headers from metadata on the Revision model class · a7d9aca2
      David Douard authored
      Add a new extra_headers attribute on Revision and use it for computing
      the revision's id instead of extract it from the metadata field.
      
      Only accept (bytes, bytes) as extra_header.
      
      Add a post init hook to Revision to initialize this new attribute from
      given metadata, if any, for bw compat.
      
      Also amend the revision_d hyptothesis strategy to generate extra_headers.
      v0.4.0
      a7d9aca2
  20. Jun 29, 2020
  21. Jun 24, 2020
  22. Jun 23, 2020
  23. Jun 22, 2020
  24. Jun 16, 2020
  25. Jun 03, 2020
  26. May 29, 2020
  27. May 20, 2020
    • David Douard's avatar
      Add support for model object anonymization · 29312dff
      David Douard authored
      Simply add a BaseModel.anonymize() method. Default implementation returns
      None, meaning the object is not anonymizable.
      
      For Person, the method returns a Person whith hashed fullname (and unset
      name and email).
      
      For Revision and Release, the method returns an anonymized version of
      the object, i.e. with instance of Person replaced by anonymized ones.
      v0.2.0
      29312dff
  28. Apr 10, 2020
  29. Apr 08, 2020
    • David Douard's avatar
      Enable black · bf3f1cec
      David Douard authored
      - blackify all the python files,
      - enable black in pre-commit,
      - add a black tox environment.
      bf3f1cec
  30. Apr 02, 2020
  31. Apr 01, 2020
Loading