def save(): rdio = rdioFromSession(session) if rdio is None: clearSession(session) return redirect(url_for('home')) try: target_playlist = request.args.get('destination', None) playlist_name = request.args.get('name', 'Billboard Playlist') tracks = request.args.get('tracks', None) if target_playlist is None: new_playlist = rdio.call( 'createPlaylist', { 'name': "Billboard " + playlist_name, 'description': '', 'tracks': 't123' })['result'] target_playlist = new_playlist['key'] if tracks is None: return render_template('error.html') result = Charter(rdio=rdio).updatePlaylist(target_playlist, tracks) if result['status'] != 'ok': raise urllib2.HTTPError() except urllib2.HTTPError: return render_template('error.html') return render_template('complete.html', result=result['result'])
def test_load_one(self, tmpdir): data = { 'machine_info': { 'cpu': 'Intel', 'python_implementation': 'CPython', }, 'datetime': 'today', 'benchmarks': [ { 'name': 'foo', 'time': 1 }, { 'name': 'bar', 'time': 2 }, ] } myfile = tmpdir.join('myfile.json') myfile.write(json.dumps(data)) # benchmarks = Charter.load_one(myfile) b1, b2 = benchmarks assert b1.name == 'foo' assert b1.time == 1 assert b1.info.machine_info.cpu == 'Intel' assert b1.python_implementation == 'CPython' assert b1.info.datetime == 'today' # assert b2.name == 'bar' assert b2.time == 2 assert b2.info.machine_info.cpu == 'Intel' assert b2.python_implementation == 'CPython' assert b2.info.datetime == 'today'
def setup(cls): if cls.charter is not None: return root = py.path.local(__file__).dirpath('..', '..') revision = commands.getoutput('git rev-parse HEAD') benchdir = root.join('.benchmarks') cls.charter = Charter(benchdir, revision)
def test_files_to_load(self, tmpdir): for impl in ('CPython', 'PyPy'): d = tmpdir.join(impl).ensure(dir=True) for i in range(20): f = d.join('%03d.json' % i).write('') # charter = Charter(tmpdir, revision='123') files = charter.files_to_load(3) files = [f.relto(tmpdir) for f in files] assert files == [ 'CPython/017.json', 'CPython/018.json', 'CPython/019.json', 'PyPy/017.json', 'PyPy/018.json', 'PyPy/019.json', ]
def __init__(self,base,quote): self.base = base self.quote = quote self.pair = self.base + '_' + self.quote self.price = Poloniex.getPrice(self,self.pair) Data.__init__(self) Charter.__init__(self) #Backtester.__init__(self) #xmr = FX("BTC","XMR") #xmr.saveChartData() #xmr.chartCandles('7D') #xmr.showChart()