Skip to content

@matschaffer /.gitignore
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
from uglycode import run
results = run({'override': 'was overridden'})
print results[0]
print results[1]
def run(overrides):
__params__ = __import__('params')
for name in dir(__params__):
value = getattr(__params__, name)
if isinstance(value, (int, long, basestring)):
globals()[name] = value
for var, val in overrides.iteritems():
globals()[var] = val
# Don't want to edit below this line
output = []
output.append("override %s" % (override))
output.append("default %s" % (default))
if False:
override='was some local crap'
return output
hairy = __import__('original')
hairy.override = 'was overridden'
results = hairy.run()
print results[0]
print results[1]
override = 'was not overridden'
default = 'was a default'
def run():
# Don't want to edit below this line
output = []
output.append("override %s" % (override))
output.append("default %s" % (default))
if False:
override='was some local crap'
return output
override = 'was not overridden'
default = 'was a default'
override was overridden
default was a default
def run(overrides):
# This works
from params import *
# This doesn't seem to
# override = 'was not overridden'
# default = 'was a default'
for var, val in overrides.iteritems():
locals()[var] = val
# Don't want to edit below this line
output = []
output.append("override %s" % (override))
output.append("default %s" % (default))
if False:
override='was some local crap'
return output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.