The Python Oracle

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

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC C Schuberts Piano Sonata No 13 D

--

Chapters
00:00 Question
00:52 Accepted answer (Score 4)
01:47 Answer 2 (Score 0)
02:00 Thank you

--

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

Question links:
[docs]: http://docs.fabfile.org/en/1.10/usage/ou...

Accepted answer links:
https://github.com/fabric/fabric/blob/ma...
https://github.com/fabric/fabric/blob/ma...

--

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