historical: Switch to relative import.

This commit is contained in:
Brett Smith 2017-05-17 12:36:04 -04:00
parent 18f7ea7038
commit f9c045a63e

View file

@ -1,4 +1,4 @@
import oxrlib.rate from .. import rate as oxrrate
def format_one_rate(rate, from_amt, from_curr, to_curr): def format_one_rate(rate, from_amt, from_curr, to_curr):
return "{:g} {} = {:g} {}".format( return "{:g} {} = {:g} {}".format(
@ -11,7 +11,7 @@ def format_rate_pair(rate, from_curr, to_curr):
def run(config, stdout, stderr): def run(config, stdout, stderr):
loaders = config.get_loaders() loaders = config.get_loaders()
with loaders.historical(config.args.date, config.args.base) as rate_json: with loaders.historical(config.args.date, config.args.base) as rate_json:
rate = oxrlib.rate.Rate.from_json_file(rate_json) rate = oxrrate.Rate.from_json_file(rate_json)
if not config.args.from_currency: if not config.args.from_currency:
for from_curr in sorted(rate.rates): for from_curr in sorted(rate.rates):
print(*format_rate_pair(rate, from_curr, config.args.to_currency), print(*format_rate_pair(rate, from_curr, config.args.to_currency),