diff --git a/larigira/audiogen.py b/larigira/audiogen.py index ef7dcab..80ba8b0 100644 --- a/larigira/audiogen.py +++ b/larigira/audiogen.py @@ -1,7 +1,7 @@ from __future__ import print_function import sys import argparse -from entrypoints_utils import get_one_entrypoint +from .entrypoints_utils import get_one_entrypoint import json from logging import getLogger log = getLogger('audiogen') diff --git a/larigira/audiogen_mpdrandom.py b/larigira/audiogen_mpdrandom.py index ceb6089..5f92d7c 100644 --- a/larigira/audiogen_mpdrandom.py +++ b/larigira/audiogen_mpdrandom.py @@ -4,7 +4,7 @@ import random from mpd import MPDClient -from config import get_conf +from .config import get_conf def generate_by_artist(spec): @@ -19,6 +19,6 @@ def generate_by_artist(spec): log.debug("got %d artists" % len(artists)) if not artists: raise ValueError("no artists in your mpd database") - for _ in xrange(spec['howmany']): + for _ in range(spec['howmany']): artist = random.choice(artists) yield random.choice(c.find('artist', artist))['file'] diff --git a/larigira/audiogen_script.py b/larigira/audiogen_script.py index 11afa60..63a2eaf 100644 --- a/larigira/audiogen_script.py +++ b/larigira/audiogen_script.py @@ -19,7 +19,7 @@ import logging import os import subprocess -from config import get_conf +from .config import get_conf log = logging.getLogger('audioscript') diff --git a/larigira/event.py b/larigira/event.py index 5d556c4..78ffb50 100644 --- a/larigira/event.py +++ b/larigira/event.py @@ -13,9 +13,9 @@ import gevent from gevent.queue import Queue from tinydb import TinyDB -from eventutils import ParentedLet -from timegen import timegenerate -from audiogen import audiogenerate +from .eventutils import ParentedLet +from .timegen import timegenerate +from .audiogen import audiogenerate class EventModel(object): diff --git a/larigira/forms.py b/larigira/forms.py index 6748b2d..8e8c54f 100644 --- a/larigira/forms.py +++ b/larigira/forms.py @@ -1,6 +1,6 @@ from logging import getLogger log = getLogger('timeform') -from entrypoints_utils import get_one_entrypoint +from .entrypoints_utils import get_one_entrypoint def get_timeform(kind): diff --git a/larigira/mpc.py b/larigira/mpc.py index 8d9968f..f734e96 100644 --- a/larigira/mpc.py +++ b/larigira/mpc.py @@ -5,8 +5,8 @@ import gevent from gevent.queue import Queue from mpd import MPDClient, ConnectionError, CommandError -from eventutils import ParentedLet, Timer -from audiogen import audiogenerate +from .eventutils import ParentedLet, Timer +from .audiogen import audiogenerate def get_mpd_client(conf): @@ -69,7 +69,7 @@ class Player(gevent.Greenlet): def add(greenlet): uris = greenlet.value for uri in uris: - assert type(uri) is unicode, type(uri) + assert type(uri) is str, type(uri) mpd_client.add(uri.strip()) picker.link_value(add) picker.start() @@ -80,7 +80,7 @@ class Player(gevent.Greenlet): assert 'uris' in songs spec = songs['audiospec'] for uri in songs['uris']: - assert type(uri) is unicode + assert type(uri) is str self.log.info('Adding {} to playlist (from {}={})'. format(uri, songs['aid'], spec)) insert_pos = 0 if len(mpd_client.playlistid()) == 0 else \ diff --git a/larigira/tests/test_parented.py b/larigira/tests/test_parented.py index 85a1e77..eb82bb0 100644 --- a/larigira/tests/test_parented.py +++ b/larigira/tests/test_parented.py @@ -20,7 +20,7 @@ def range_parentlet(): self.howmany = howmany def do_business(self): - for i in xrange(self.howmany): + for i in range(self.howmany): yield('range', i) return RangeLet diff --git a/larigira/timegen.py b/larigira/timegen.py index 4e8e795..4d5b7a5 100644 --- a/larigira/timegen.py +++ b/larigira/timegen.py @@ -3,12 +3,12 @@ main module to read and get informations about alarms ''' from __future__ import print_function import sys +from datetime import datetime import argparse -from entrypoints_utils import get_one_entrypoint import json +from .entrypoints_utils import get_one_entrypoint from logging import getLogger log = getLogger('timegen') -from datetime import datetime def get_timegenerator(kind): @@ -52,7 +52,7 @@ def timegenerate(spec, now=None, howmany=1): if now is not None: if type(now) is not datetime: now = datetime.fromtimestamp(now) - for _ in xrange(howmany): + for _ in range(howmany): now = generator.next_ring(current_time=now) yield now