Skip to content

Commit

Permalink
[*] The Zen of Python #7: readability counts.
Browse files Browse the repository at this point in the history
  • Loading branch information
StyXman committed Oct 6, 2015
1 parent 82511f2 commit bc52e83
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ayrton/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ def close (self):
class remote:
"Uses the same arguments as paramiko.SSHClient.connect ()"
def __init__ (self, ast, hostname, *args, **kwargs):
def param (p, d, v=False):
if p in d:
v= d[p]
del d[p]
setattr (self, p, v)
def param (param, kwargs, default_value=False):
"""gets a param from kwargs, or uses a default_value. if found, it's
removed from kwargs"""
if param in kwargs:
value= kwargs[param]
del kwargs[param]
else:
value= default_value
setattr (self, param, value)

# actually, it's not a proper ast, it's the pickle of such thing
self.ast= ast
Expand Down Expand Up @@ -147,7 +151,7 @@ def __enter__ (self):
# this is not so easy: for some reason, ayrton.runner.locals is not up to
# date in the middle of the execution (remember *this* code is executed
# via exec() in Ayrton.run_code())
# another option is go go through the frames
# another option is to go through the frames
inception_locals= sys._getframe().f_back.f_locals

l= dict ([ (k, v) for (k, v) in inception_locals.items ()
Expand Down

0 comments on commit bc52e83

Please sign in to comment.