mirror of
https://github.com/beetbox/beets.git
synced 2026-02-06 07:22:18 +01:00
Import unicode_literals in beets.dbcore
This commit is contained in:
parent
8dd7bf0f0b
commit
6fff7a954c
6 changed files with 14 additions and 9 deletions
|
|
@ -15,7 +15,7 @@
|
|||
"""DBCore is an abstract database package that forms the basis for beets'
|
||||
Library.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .db import Model, Database
|
||||
from .query import Query, FieldQuery, MatchQuery, AndQuery, OrQuery
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""The central Model and Database constructs for DBCore.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import time
|
||||
import os
|
||||
|
|
@ -547,13 +548,13 @@ class Results(object):
|
|||
'SELECT * FROM {0} WHERE entity_id=?'.format(
|
||||
self.model_class._flex_table
|
||||
),
|
||||
(row['id'],)
|
||||
(row[b'id'],)
|
||||
)
|
||||
|
||||
cols = dict(row)
|
||||
values = dict((k, v) for (k, v) in cols.items()
|
||||
if not k[:4] == 'flex')
|
||||
flex_values = dict((row['key'], row['value']) for row in flex_rows)
|
||||
flex_values = dict((row[b'key'], row[b'value']) for row in flex_rows)
|
||||
|
||||
# Construct the Python object
|
||||
obj = self.model_class._awaken(self.db, values, flex_values)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""The Query type hierarchy for DBCore.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
from operator import attrgetter
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Representation of type information for DBCore model fields.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from . import query
|
||||
from beets.util import str2bool
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Tests for the DBCore database abstraction.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
|
|
@ -189,7 +190,7 @@ class ModelTest(unittest.TestCase):
|
|||
model.field_one = 123
|
||||
model.store()
|
||||
row = self.db._connection().execute('select * from test').fetchone()
|
||||
self.assertEqual(row['field_one'], 123)
|
||||
self.assertEqual(row[b'field_one'], 123)
|
||||
|
||||
def test_retrieve_by_id(self):
|
||||
model = TestModel1()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Various tests for querying the library database.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from test import _common
|
||||
from test._common import unittest
|
||||
|
|
|
|||
Loading…
Reference in a new issue