Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Latest commit

 

History

History
34 lines (23 loc) · 788 Bytes

DUO114.md

File metadata and controls

34 lines (23 loc) · 788 Bytes

DUO114

This linter looks for returnValue calls that are in a function missing a inlineCallbacks decorator.

Problematic code

from twisted.internet import defer

def func(arg):
    result = yield other_inlinecallbacks_func(arg + 5)
    defer.returnValue(result)

Correct code

from twisted.internet import defer

@defer.inlineCallbacks
def func(arg):
    result = yield other_inlinecallbacks_func(arg + 5)
    defer.returnValue(result)

Rationale

A returnValue call implies that a function should be using inlineCallbacks. For more information see returnValue.

Exceptions

None - if you don't need inlineCallbacks you can simply use return