Python Multiline Chained Methods Call Indent

April 24, 2019
query = db.collection("test") \
    .where("is_active", '==', True) \
    .where("is_posted", '==', True) \
    .order_by("modified", direction=firestore.Query.DESCENDING) \
    .limit(10)

or

query = (db.collection("test")
    .where("is_active", '==', True)
    .where("is_posted", '==', True)
    .order_by("modified", direction=firestore.Query.DESCENDING)
    .limit(10))

or

query = db.collection("test"
    ).where("is_active", '==', True
    ).where("is_posted", '==', True
    ).order_by("modified", direction=firestore.Query.DESCENDING
    ).limit(10)

This following will cause unexpected indent.

query = db.collection("test")
    .where("is_active", '==', True)
    .where("is_posted", '==', True)
    .order_by("modified", direction=firestore.Query.DESCENDING)
    .limit(10)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.