Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View .gitignore
1 2 3 4 5 6
from uglycode import run
 
results = run({'override': 'was overridden'})
 
print results[0]
print results[1]
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 
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
View .gitignore
1 2 3 4 5 6 7 8
hairy = __import__('original')
hairy.override = 'was overridden'
 
results = hairy.run()
 
print results[0]
print results[1]
 
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14
 
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
View .gitignore
1 2
override = 'was not overridden'
default = 'was a default'
View .gitignore
1 2
override was overridden
default was a default
View .gitignore
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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.