From 289094362e8c4e55f721b86e87d25b82f5948e03 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 10 Jul 2014 20:27:24 +0400 Subject: [PATCH] Rename find_config_file to _find_config_file --- powerline/__init__.py | 6 +++--- powerline/lint/__init__.py | 2 +- tests/lib/config_mock.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/powerline/__init__.py b/powerline/__init__.py index bbb8e0b3..33438d13 100644 --- a/powerline/__init__.py +++ b/powerline/__init__.py @@ -13,7 +13,7 @@ from powerline.config import DEFAULT_SYSTEM_CONFIG_DIR from threading import Lock, Event -def find_config_file(search_paths, config_file): +def _find_config_file(search_paths, config_file): config_file += '.json' for path in search_paths: config_file_path = os.path.join(path, config_file) @@ -158,7 +158,7 @@ class Powerline(object): self.renderer_module = self.renderer_module[:-1] config_paths = self.get_config_paths() - self.find_config_file = lambda cfg_path: find_config_file(config_paths, cfg_path) + self.find_config_file = lambda cfg_path: _find_config_file(config_paths, cfg_path) self.cr_kwargs_lock = Lock() self.create_renderer_kwargs = {} @@ -483,7 +483,7 @@ class Powerline(object): pass functions = tuple(self.cr_callbacks.values()) self.config_loader.unregister_functions(set(functions)) - self.config_loader.unregister_missing(set(((find_config_file, function) for function in functions))) + self.config_loader.unregister_missing(set(((self.find_config_file, function) for function in functions))) def __enter__(self): return self diff --git a/powerline/lint/__init__.py b/powerline/lint/__init__.py index 928f144e..01f12cb7 100644 --- a/powerline/lint/__init__.py +++ b/powerline/lint/__init__.py @@ -1,7 +1,7 @@ # vim:fileencoding=utf-8:noet from powerline.lint.markedjson import load -from powerline import find_config_file, Powerline +from powerline import _find_config_file as find_config_file, Powerline from powerline.lib.config import load_json_config from powerline.lint.markedjson.error import echoerr, MarkedError from powerline.segments.vim import vim_modes diff --git a/tests/lib/config_mock.py b/tests/lib/config_mock.py index f4f50624..22dad715 100644 --- a/tests/lib/config_mock.py +++ b/tests/lib/config_mock.py @@ -22,7 +22,7 @@ def load_json_config(config_file_path, *args, **kwargs): raise IOError(config_file_path) -def find_config_file(config, search_paths, config_file): +def _find_config_file(config, search_paths, config_file): if config_file.endswith('raise') and config_file not in config: raise IOError('fcf:' + config_file) return config_file @@ -158,7 +158,7 @@ def swap_attributes(cfg_container, powerline_module, replaces): config_container = cfg_container if not replaces: replaces = { - 'find_config_file': lambda *args: find_config_file(config_container['config'], *args), + '_find_config_file': lambda *args: _find_config_file(config_container['config'], *args), } for attr, val in replaces.items(): old_val = getattr(powerline_module, attr)