From 07189adf9b2bea4d5ead900693972ebc2dc631e1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 28 Aug 2010 19:35:49 -0400 Subject: [PATCH] .__setup_params() -> ._setup_params() in hooke/plugin/*.py. Methods starting with '__' get special name mangling. http://docs.python.org/reference/expressions.html#atom-identifiers We don't want any of that. --- hooke/plugin/command_stack.py | 12 ++++++------ hooke/plugin/curve.py | 12 ++++++------ hooke/plugin/flatfilt.py | 4 ++-- hooke/plugin/playlist.py | 4 ++-- hooke/plugin/polymer_fit.py | 4 ++-- hooke/plugin/vclamp.py | 16 ++++++++-------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/hooke/plugin/command_stack.py b/hooke/plugin/command_stack.py index 3dfc731..59ca5dd 100644 --- a/hooke/plugin/command_stack.py +++ b/hooke/plugin/command_stack.py @@ -228,10 +228,10 @@ input command stack. If the command stack does not have an input file help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - params = self.__setup_params(hooke, params) + params = self._setup_params(hooke, params) self.plugin.command_stack.save(params['output']) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): if params['output'] == None and self.plugin.command_stack.path == None: params['output'] = 'default' if params['output'] != None: @@ -256,11 +256,11 @@ File name for the input command stack. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - params = self.__setup_params(hooke, params) + params = self._setup_params(hooke, params) self.plugin.command_stack.clear() self.plugin.command_stack.load(params['input']) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): if params['input'] == None and self.plugin.command_stack.path == None: params['input'] = 'default' if params['input'] != None: @@ -285,12 +285,12 @@ current stack. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) if len(params['commands']) == 0: return params['commands'].execute(hooke=hooke, stack=params['stack']) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): if params['commands'] == None: params['commands'] = self.plugin.command_stack return params diff --git a/hooke/plugin/curve.py b/hooke/plugin/curve.py index d51ddfd..5df5629 100644 --- a/hooke/plugin/curve.py +++ b/hooke/plugin/curve.py @@ -451,7 +451,7 @@ Name of the new column for storing the difference (without units, defaults to def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) data_A = self._get_column(hooke=hooke, params=params, block_name='block A', column_name='column A') @@ -464,7 +464,7 @@ Name of the new column for storing the difference (without units, defaults to column_name='output column', values=out) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): curve = self._curve(hooke, params) if params['block A'] == None: params['block A'] = curve.data[0].info['name'] @@ -526,7 +526,7 @@ central differencing. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) x_data = self._get_column(hooke=hooke, params=params, column_name='x column') f_data = self._get_column(hooke=hooke, params=params, @@ -537,7 +537,7 @@ central differencing. column_name='output column', values=d) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): curve = self._curve(hooke, params) x_name,x_unit = split_data_label(params['x column']) f_name,f_unit = split_data_label(params['f column']) @@ -591,7 +591,7 @@ Otherwise, the chunks are end-to-end, and not overlapping. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) data = self._get_column(hooke=hooke, params=params) bounds = params['bounds'] if bounds != None: @@ -615,7 +615,7 @@ Otherwise, the chunks are end-to-end, and not overlapping. values=power) outqueue.put(b) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): if params['output block'] in self._block_names(hooke, params): raise Failure('output block %s already exists in %s.' % (params['output block'], diff --git a/hooke/plugin/flatfilt.py b/hooke/plugin/flatfilt.py index 79300cd..21665fe 100644 --- a/hooke/plugin/flatfilt.py +++ b/hooke/plugin/flatfilt.py @@ -144,7 +144,7 @@ Name for storing the list of peaks in the `.info` dictionary. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) block = self._block(hooke=hooke, params=params) dist_data = self._get_column(hooke=hooke, params=params, column_name='distance column') @@ -165,7 +165,7 @@ Name for storing the list of peaks in the `.info` dictionary. values=peaks_to_mask(def_data, peaks) * def_data) outqueue.put(peaks) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): """Setup `params` from config and return the z piezo and deflection arrays. """ diff --git a/hooke/plugin/playlist.py b/hooke/plugin/playlist.py index 43978b5..616cfed 100644 --- a/hooke/plugin/playlist.py +++ b/hooke/plugin/playlist.py @@ -372,7 +372,7 @@ Evaluate the applied command stack immediately. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) p = self._playlist(hooke, params) if params['evaluate'] == True: exec_cmd = hooke.command_by_name['execute command stack'] @@ -387,7 +387,7 @@ Evaluate the applied command stack immediately. curve.set_hooke(hooke) p.unload(curve) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): if params['commands'] == None: cstack_plugin = [p for p in hooke.plugins if p.name == 'command_stack'][0] diff --git a/hooke/plugin/polymer_fit.py b/hooke/plugin/polymer_fit.py index c3d715c..9d1a86b 100644 --- a/hooke/plugin/polymer_fit.py +++ b/hooke/plugin/polymer_fit.py @@ -944,7 +944,7 @@ Indicies of points bounding the selected data. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - params = self.__setup_params(hooke, params) + params = self._setup_params(hooke, params) data = self._block(hooke, params) model = params['polymer model'] dist_data = self._get_column( @@ -960,7 +960,7 @@ Indicies of points bounding the selected data. column_name='output tension column', values=tension_data) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): for key,value in params.items(): if value == None: # Use configured default value. params[key] = self.plugin.config[key] diff --git a/hooke/plugin/vclamp.py b/hooke/plugin/vclamp.py index 88306ff..441f1fe 100644 --- a/hooke/plugin/vclamp.py +++ b/hooke/plugin/vclamp.py @@ -304,7 +304,7 @@ Name (without units) for storing fit parameters in the `.info` dictionary. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) block = self._block(hooke=hooke, params=params) dist_data = self._get_column(hooke=hooke, params=params, column_name='distance column') @@ -323,7 +323,7 @@ Name (without units) for storing fit parameters in the `.info` dictionary. column_name='output deflection column', values=def_data - def_offset) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): name,dist_unit = split_data_label(params['distance column']) name,def_unit = split_data_label(params['deflection column']) params['output distance column'] = join_data_label( @@ -521,7 +521,7 @@ Name of the spring constant in the `.info` dictionary. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) def_data = self._get_column(hooke=hooke, params=params, column_name='deflection column') out = def_data * def_data.info[params['spring constant info name']] @@ -529,7 +529,7 @@ Name of the spring constant in the `.info` dictionary. column_name='output deflection column', values=out) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): name,in_unit = split_data_label(params['deflection column']) out_unit = 'N' # HACK: extract target units from k_unit. params['output deflection column'] = join_data_label( @@ -579,7 +579,7 @@ Name of the spring constant in the `.info` dictionary. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) def_data = self._get_column(hooke=hooke, params=params, column_name='deflection column') dist_data = self._get_column(hooke=hooke, params=params, @@ -592,7 +592,7 @@ Name of the spring constant in the `.info` dictionary. column_name='output distance column', values=dist_data - def_data / k) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): name,dist_unit = split_data_label(params['distance column']) name,def_unit = split_data_label(params['deflection column']) params['output distance column'] = join_data_label( @@ -656,7 +656,7 @@ Name of the flattening information in the `.info` dictionary. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) - params = self.__setup_params(hooke=hooke, params=params) + params = self._setup_params(hooke=hooke, params=params) block = self._block(hooke=hooke, params=params) dist_data = self._get_column(hooke=hooke, params=params, column_name='distance column') @@ -690,7 +690,7 @@ Name of the flattening information in the `.info` dictionary. column_name='output deflection column', values=out) - def __setup_params(self, hooke, params): + def _setup_params(self, hooke, params): d_name,d_unit = split_data_label(params['deflection column']) params['output deflection column'] = join_data_label( params['output deflection column'], d_unit) -- 2.26.2