Skip to content

Commit

Permalink
issue: kupferlauncher#61-JSON - MAINT: Clean up kupfer.core.settings k…
Browse files Browse the repository at this point in the history
…upferlauncher#61 - JSON POC; commit: rename _same_type as _same_val
  • Loading branch information
hugosenari committed Apr 10, 2017
1 parent f7d6125 commit fcf8534
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kupfer/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _override_encoding(name):
return None


def _same_type(value):
def _same_val(value):
return value

def _merge(old, new):
Expand Down Expand Up @@ -153,7 +153,7 @@ def _set_config(self, section, key, value):
key = key.lower()
oldvalue = self._config[section].get(key)
if section in self.defaults:
value_type = type(oldvalue) if oldvalue is not None else _same_type
value_type = type(oldvalue) if oldvalue is not None else _same_val
self._config[section][key] = value_type(value)
self._emit_value_changed(section, key, value)
self._update_config_save_timer()
Expand Down Expand Up @@ -317,7 +317,7 @@ def get_special_dir(opt):
def set_directories(self, dirs):
return self._set_config("Directories", "direct", dirs)

def get_plugin_config(self, plugin, key, value_type=_same_type, default=None):
def get_plugin_config(self, plugin, key, value_type=_same_val, default=None):
"""Return setting @key for plugin names @plugin, try
to coerce to type @value_type.
Else return @default if does not exist, or can't be coerced
Expand All @@ -343,7 +343,7 @@ def get_plugin_config(self, plugin, key, value_type=_same_type, default=None):
return default
return val

def set_plugin_config(self, plugin, key, value, value_type=_same_type):
def set_plugin_config(self, plugin, key, value, value_type=_same_val):
"""Try set @key for plugin names @plugin, coerce to @value_type
first. """
plug_section = "plugin_%s" % plugin
Expand Down

0 comments on commit fcf8534

Please sign in to comment.