Page MenuHomeSoftware Heritage

Use Optional[x] instead of Union[x, None]
ClosedPublic

Authored by olasd on Apr 9 2020, 2:12 PM.

Details

Summary

That's a really trivial change

Test Plan

mypy

Diff Detail

Repository
rDJNL Journal infrastructure
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

This revision is now accepted and ready to land.Apr 9 2020, 2:22 PM

the commit message should mention you added a default value

Build has FAILED

Patch application report for D2992 (id=10631)

Could not rebase; Attempt merge onto 893d285adf...

Updating 893d285..7b9dc4d
Fast-forward
 swh/journal/serializers.py  |  6 ++++--
 swh/journal/writer/kafka.py | 15 ++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)
Changes applied before test
commit 7b9dc4d477b994846c7027481c96e949bbda7fd9
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 17:00:42 2020 +0200

    Use Optional[x] instead of Union[x, None]

commit e1ab119cc51aec0440ffaf8431e05b2e60609763
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 16:58:51 2020 +0200

    Introduce a KeyType alias in serializers to factor out its definition

commit 08348047d28bfd699a827f6a6b0fcf5dc8625aca
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 16:50:57 2020 +0200

    Accept Sequence[ModelObject] instead of List[ModelObject]
    
    The latter is invariant (because List is a mutable type), so it doesn't allow
    passing in lists of ModelObject subtypes.

Link to build: https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/23/
See console output for more information: https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/23/console

the commit message should mention you added a default value

It used to have a default value (that's pretty clear from the body of the function), not sure where/why it got dropped.

Build is green

Patch application report for D2992 (id=10637)

Could not rebase; Attempt merge onto 893d285adf...

Updating 893d285..0188902
Fast-forward
 swh/journal/serializers.py  |  6 ++++--
 swh/journal/writer/kafka.py | 15 ++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)
Changes applied before test
commit 0188902962eb7cd91d471fdd3984b13ab235339a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 17:00:42 2020 +0200

    Use Optional[x] instead of Union[x, None]

commit bd966490570c3d07df2e3adbb81b83ef3db2aed7
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 16:58:51 2020 +0200

    Introduce a KeyType alias in serializers to factor out its definition

commit eb4f3626e8f3f6e0cffbc610fdd47e06ddbdac22
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Wed Apr 8 16:50:57 2020 +0200

    write_additions: Accept Iterable[ModelObject] instead of List[ModelObject]
    
    This allows us to pass objects typed as lists of ModelObject subtypes.

See https://jenkins.softwareheritage.org/job/DJNL/job/tests-on-diff/28/ for more details.

This revision was automatically updated to reflect the committed changes.