The Python Oracle

What does Fabric's `hide("everything")` actually hide?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 What Does Fabric'S `Hide(&Quot;Everything&Quot;)` Actually Hide?
00:37 Accepted Answer Score 4
01:21 Answer 2 Score 0
01:29 Thank you

--

Full question
https://stackoverflow.com/questions/3449...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #fabric

#avk47



ACCEPTED ANSWER

Score 4


When in doubt, look at the source:

https://github.com/fabric/fabric/blob/master/fabric/context_managers.py#L98

here is the actual declaration. everything is pretty much everything: warnings, running, user, output, exceptions

https://github.com/fabric/fabric/blob/master/fabric/state.py#L411

It's just a nice wrapper around output. Frankly i would stick to their build-in decorators since that has less chances of changing, plus you get the added value of more pythonic-readable code:

@task
def task1():
    with hide('running', 'stdout', 'stderr'):
        run('ls /var/www')
        ....

vs.

@task
def task1():
    output['running'] = False
    output['stdout'] = False
    output['stderr'] = False
    # or just output['everything'] = False
    run('ls /var/www')
    ....

BUT, at the end of the day its the same thing.




ANSWER 2

Score 0


This is what I have always used:

from fabric.state import output

output['everything'] = False