mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 20:42:37 +01:00
Changing to some more meaningful names
This commit is contained in:
parent
c7f4b8a095
commit
e72fcc4b68
1 changed files with 4 additions and 4 deletions
|
|
@ -168,7 +168,7 @@ def _str_to_bool(value):
|
|||
raise ValueError('could not convert string to bool: {0}'.format(value))
|
||||
|
||||
# Mapping the correspondent Python constructor to SQLite field types
|
||||
TYPE_MAPPING = {
|
||||
CONSTRUCTOR_MAPPING = {
|
||||
'int': int,
|
||||
'bool': _str_to_bool,
|
||||
'real': float,
|
||||
|
|
@ -177,9 +177,9 @@ TYPE_MAPPING = {
|
|||
# Convert a string (from user input) to the correct Python type
|
||||
def _convert_type(fields, key, value):
|
||||
sqlite_type = [f[1] for f in fields if f[0] == key][0]
|
||||
if value and sqlite_type in TYPE_MAPPING:
|
||||
python_type = TYPE_MAPPING[sqlite_type]
|
||||
return python_type(value)
|
||||
if value and sqlite_type in CONSTRUCTOR_MAPPING:
|
||||
constructor = CONSTRUCTOR_MAPPING[sqlite_type]
|
||||
return constructor(value)
|
||||
return value
|
||||
|
||||
# Logger.
|
||||
|
|
|
|||
Loading…
Reference in a new issue