From 36128b75def08d01961c3f16bce7b4fcecace335 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Wed, 8 Jan 2020 12:33:14 +0100
Subject: [PATCH] doc: cleanup whitespace

- remove trailing whitespace
- replace tabs with spaces as per PEP guidelines

(cherry picked from commit 8fbb77303aabf618e4178865f6370fad962f9a0c)
---
 doc/manual/source/bibliography.rst   |  3 -
 doc/manual/source/conf.py            |  2 +-
 doc/manual/source/index.rst          |  4 +-
 doc/manual/source/introduction.rst   |  6 +-
 doc/manual/source/the-model-file.rst | 32 +++++-----
 doc/manual/utils/dynare_dom.py       | 90 ++++++++++++++--------------
 doc/manual/utils/dynare_lex.py       | 79 ++++++++++++------------
 7 files changed, 106 insertions(+), 110 deletions(-)

diff --git a/doc/manual/source/bibliography.rst b/doc/manual/source/bibliography.rst
index db154cd026..dce3c0d89e 100644
--- a/doc/manual/source/bibliography.rst
+++ b/doc/manual/source/bibliography.rst
@@ -68,6 +68,3 @@ Bibliography
 * Stock, James H. and Mark W. Watson (1999). “Forecasting Inflation,”, *Journal of Monetary Economics*, 44(2), 293–335.
 * Uhlig, Harald (2001): “A Toolkit for Analysing Nonlinear Dynamic Stochastic Models Easily,” in *Computational Methods for the Study of Dynamic Economies*, Eds. Ramon Marimon and Andrew Scott, Oxford University Press, 30–61.
 * Villemot, Sébastien (2011): “Solving rational expectations models at first order: what Dynare does,” *Dynare Working Papers*, 2, CEPREMAP.
-
-
-
diff --git a/doc/manual/source/conf.py b/doc/manual/source/conf.py
index 2091363291..8f8a1079f4 100644
--- a/doc/manual/source/conf.py
+++ b/doc/manual/source/conf.py
@@ -23,7 +23,7 @@ import sys
 sys.path.insert(0, os.path.abspath('../utils'))
 
 extensions = ['sphinx.ext.autodoc',
-			  'sphinx.ext.mathjax']
+              'sphinx.ext.mathjax']
 
 source_suffix = '.rst'
 
diff --git a/doc/manual/source/index.rst b/doc/manual/source/index.rst
index 98a280feff..d707b92f64 100644
--- a/doc/manual/source/index.rst
+++ b/doc/manual/source/index.rst
@@ -34,7 +34,7 @@ A copy of the license can be found at `http://www.gnu.org/licenses/fdl.txt <http
 .. toctree::
    :numbered:
    :maxdepth: 4
-   
+
    introduction
    installation-and-configuration
    running-dynare
@@ -51,4 +51,4 @@ A copy of the license can be found at `http://www.gnu.org/licenses/fdl.txt <http
    Indices and tables
    ==================
 
-	* :ref:`genindex`
+   * :ref:`genindex`
diff --git a/doc/manual/source/introduction.rst b/doc/manual/source/introduction.rst
index 0560d5c2f5..7d447d3b94 100644
--- a/doc/manual/source/introduction.rst
+++ b/doc/manual/source/introduction.rst
@@ -104,10 +104,10 @@ For convenience, you can copy and paste the following into your BibTeX file:
     .. code-block:: bibtex
 
         @TechReport{Adjemianetal2011,
-          author      = {Adjemian, St\'ephane and Bastani, Houtan and 
-                         Juillard, Michel and Karam\'e, Fr\'ederic and 
+          author      = {Adjemian, St\'ephane and Bastani, Houtan and
+                         Juillard, Michel and Karam\'e, Fr\'ederic and
                          Maih, Junior and Mihoubi, Ferhat and
-                         Perendia, George and Pfeifer, Johannes and 
+                         Perendia, George and Pfeifer, Johannes and
                          Ratto, Marco and Villemot, S\'ebastien},
           title       = {Dynare: Reference Manual Version 4},
           year        = {2011},
diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst
index 249cf94891..d7e227ee84 100644
--- a/doc/manual/source/the-model-file.rst
+++ b/doc/manual/source/the-model-file.rst
@@ -3740,7 +3740,7 @@ lag. We therefore have the following identity:
 
         Vector of numerical indices identifying the state variables in the
         vector of declared variables. ``M_.endo_names(M_.state_var)``
-        therefore yields the name of all variables that are states in 
+        therefore yields the name of all variables that are states in
         the model declaration, i.e. that show up with a lag.
 
 Internally, Dynare uses two orderings of the endogenous variables: the
@@ -3758,10 +3758,10 @@ according to the declaration order.
 .. matvar:: oo_.dr.order_var
 
        This variables maps DR-order to declaration order.
-       
+
 .. matvar:: oo_.dr.inv_order_var
 
-       This variable contains the inverse map. 
+       This variable contains the inverse map.
 
 In other words, the k-th variable in the DR-order corresponds to the endogenous
 variable numbered ``oo_.dr.order_var(k)`` in declaration
@@ -3791,7 +3791,7 @@ where :math:`y^s` is the steady state value of :math:`y` and
 .. matvar:: oo.dr.state_var
 
         Vector of numerical indices identifying the state variables in the
-        vector of declared variables, *given the current parameter values* 
+        vector of declared variables, *given the current parameter values*
         for which the decision rules have been computed. It may differ from
         ``M_.state_var`` in case a state variable drops from the model given
         the current parameterization, because it only gets 0 coefficients in
@@ -7371,14 +7371,14 @@ Shock Decomposition
 
     .. option:: diff
 
-        If passed, plot the decomposition of the first difference of the list of variables. 
-        If used in combination with :opt:`flip`, the ``diff`` operator is first applied. 
+        If passed, plot the decomposition of the first difference of the list of variables.
+        If used in combination with :opt:`flip`, the ``diff`` operator is first applied.
         Default: not activated
 
     .. option:: flip
 
-        If passed, plot the decomposition of the opposite of the list of variables. 
-        If used in combination with :opt:`diff`, the ``diff`` operator is first applied. 
+        If passed, plot the decomposition of the opposite of the list of variables.
+        If used in combination with :opt:`diff`, the ``diff`` operator is first applied.
         Default: not activated
 
     .. option:: max_nrows
@@ -7467,14 +7467,14 @@ Shock Decomposition
 
     .. option:: diff
 
-        If passed, plot the decomposition of the first difference of the list of variables. 
-        If used in combination with :opt:`flip`, the ``diff`` operator is first applied. 
+        If passed, plot the decomposition of the first difference of the list of variables.
+        If used in combination with :opt:`flip`, the ``diff`` operator is first applied.
         Default: not activated
 
     .. option:: flip
 
-        If passed, plot the decomposition of the opposite of the list of variables. 
-        If used in combination with :opt:`diff`, the ``diff`` operator is first applied. 
+        If passed, plot the decomposition of the opposite of the list of variables.
+        If used in combination with :opt:`diff`, the ``diff`` operator is first applied.
         Default: not activated
 
 .. command:: squeeze_shock_decomposition [VARIABLE_NAME]...;
@@ -9057,7 +9057,7 @@ Performing identification analysis
         triggers gsa prior sample. If equal to ``2``, triggers gsa
         Monte-Carlo sample (i.e. loads a sample corresponding to
         ``pprior=0`` and ``ppost=0`` in the ``dynare_sensitivity``
-        options). If equal to ``FILENAME`` uses the provided path to 
+        options). If equal to ``FILENAME`` uses the provided path to
         a specific user defined sample file.
         Default: ``0``.
 
@@ -9213,8 +9213,8 @@ Performing identification analysis
         If equal to ``1``: finds problematic parameters in a bruteforce
         fashion: It computes the rank of the Jacobians for all possible
         parameter combinations. If the rank condition is not fullfilled,
-        these parameter sets are flagged as non-identifiable. 
-        The maximum dimension of the group searched is triggered by 
+        these parameter sets are flagged as non-identifiable.
+        The maximum dimension of the group searched is triggered by
         ``max_dim_subsets_groups``.
         Default: ``0``.
 
@@ -10477,7 +10477,7 @@ Dynare has comments to plot the results of a simulation and to save the results.
     In MATLAB or Octave, variables saved with the ``dynasave`` command
     can be retrieved by the command::
 
-        load(FILENAME,'-mat') 
+        load(FILENAME,'-mat')
 
 
 .. _macro-proc-lang:
diff --git a/doc/manual/utils/dynare_dom.py b/doc/manual/utils/dynare_dom.py
index 6a28559130..82d83ead5c 100644
--- a/doc/manual/utils/dynare_dom.py
+++ b/doc/manual/utils/dynare_dom.py
@@ -45,7 +45,7 @@ from sphinx.util.docfields import Field, GroupedField, TypedField
 class DynObject(ObjectDescription):
     has_arguments  = True
     display_prefix = None
-    allow_nesting  = False          
+    allow_nesting  = False
 
     def handle_signature(self, sig, signode):
         sig = sig.strip()
@@ -76,9 +76,9 @@ class DynObject(ObjectDescription):
 
         if self.display_prefix:
             signode += addnodes.desc_annotation(self.display_prefix, self.display_prefix)
-        
+
         signode += addnodes.desc_name(name, name)
-        
+
         if self.has_arguments:
             if not arglist:
                 signode += addnodes.desc_parameterlist()
@@ -94,7 +94,7 @@ class DynObject(ObjectDescription):
             signode['first'] = not self.names
             self.state.document.note_explicit_target(signode)
             objects = self.env.domaindata['dynare']['objects']
-            
+
             if fullname in objects:
                 self.state_machine.reporter.warning(
                     'duplicate object description of %s, ' % fullname +
@@ -222,9 +222,9 @@ class DynSimpleObject(ObjectDescription):
 
         if self.display_prefix:
             signode += addnodes.desc_annotation(self.display_prefix, self.display_prefix)
-        
+
         signode += addnodes.desc_name(name, name)
-        return fullname, prefix    
+        return fullname, prefix
 
     def add_target_and_index(self, name_obj, sig, signode):
         fullname = name_obj[0]
@@ -291,40 +291,40 @@ class DynareDomain(Domain):
     name = 'dynare'
     label = 'Dynare'
     object_types = {
-    'function':      ObjType(l_('function'),         'func'),
-    'datesmethod':   ObjType(l_('method'),           'datmeth'),
-    'dseriesmethod': ObjType(l_('method'),           'dsermeth'),
-    'reportingmethod': 	 ObjType(l_('method'),       'repmeth'),
-    'matcomm':   	 ObjType(l_('matlab command'),   'mcomm'),
-    'command':   	 ObjType(l_('command'),          'comm'),
-    'class':     	 ObjType(l_('class'),            'class'),
-    'block':     	 ObjType(l_('block'),            'bck'),
-    'confblock': 	 ObjType(l_('config block'),     'cbck'),
-    'macrodir':  	 ObjType(l_('macro directive'),  'mdir'),
-    'construct': 	 ObjType(l_('constructor'),      'cstr'),
-    'matvar':    	 ObjType(l_('matlab variable'),  'mvar'),
-    'specvar':   	 ObjType(l_('special variable'), 'svar'),
-    'operator':  	 ObjType(l_('operator'),         'op'),
-    'constant':  	 ObjType(l_('constant'),         'const'),
-    'option':    	 ObjType(l_('option'),           'opt'),
+    'function':          ObjType(l_('function'),         'func'),
+    'datesmethod':       ObjType(l_('method'),           'datmeth'),
+    'dseriesmethod':     ObjType(l_('method'),           'dsermeth'),
+    'reportingmethod':   ObjType(l_('method'),       'repmeth'),
+    'matcomm':           ObjType(l_('matlab command'),   'mcomm'),
+    'command':           ObjType(l_('command'),          'comm'),
+    'class':             ObjType(l_('class'),            'class'),
+    'block':             ObjType(l_('block'),            'bck'),
+    'confblock':         ObjType(l_('config block'),     'cbck'),
+    'macrodir':          ObjType(l_('macro directive'),  'mdir'),
+    'construct':         ObjType(l_('constructor'),      'cstr'),
+    'matvar':            ObjType(l_('matlab variable'),  'mvar'),
+    'specvar':           ObjType(l_('special variable'), 'svar'),
+    'operator':          ObjType(l_('operator'),         'op'),
+    'constant':          ObjType(l_('constant'),         'const'),
+    'option':            ObjType(l_('option'),           'opt'),
     }
     directives = {
-    'function':      DynFunction,
-    'datesmethod':   DatesMethod,
-    'dseriesmethod': DseriesMethod,
-    'reportingmethod': 	 ReportingMethod,
-    'matcomm':   	 MatComm,
-    'command':   	 DynComm,
-    'class':     	 DynClass,
-    'block':     	 DynBlock,
-    'confblock': 	 DynConfBlock,
-    'macrodir':  	 DynMacroDir,
-    'construct': 	 Constructor,   
-    'matvar':    	 MatlabVar,
-    'specvar':   	 SpecialVar,  
-    'operator':  	 Operator, 
-    'constant':  	 Constant,
-    'option':    	 Option,
+    'function':          DynFunction,
+    'datesmethod':       DatesMethod,
+    'dseriesmethod':     DseriesMethod,
+    'reportingmethod':   ReportingMethod,
+    'matcomm':           MatComm,
+    'command':           DynComm,
+    'class':             DynClass,
+    'block':             DynBlock,
+    'confblock':         DynConfBlock,
+    'macrodir':          DynMacroDir,
+    'construct':         Constructor,
+    'matvar':            MatlabVar,
+    'specvar':           SpecialVar,
+    'operator':          Operator,
+    'constant':          Constant,
+    'option':            Option,
     }
     roles = {
     'func':     DynareXRefRole(),
@@ -334,19 +334,19 @@ class DynareDomain(Domain):
     'mcomm':    DynareXRefRole(),
     'comm':     DynareXRefRole(),
     'class':    DynareXRefRole(),
-    'bck':      DynareXRefRole(),    
+    'bck':      DynareXRefRole(),
     'cbck':     DynareXRefRole(),
     'mdir':     DynareXRefRole(),
-    'cstr':     DynareXRefRole(),       
-    'mvar':     DynareXRefRole(),   
-    'svar':     DynareXRefRole(),    
-    'op':       DynareXRefRole(),     
+    'cstr':     DynareXRefRole(),
+    'mvar':     DynareXRefRole(),
+    'svar':     DynareXRefRole(),
+    'op':       DynareXRefRole(),
     'const':    DynareXRefRole(),
-    'opt':      DynareXRefRole(),  
+    'opt':      DynareXRefRole(),
     }
     initial_data = {
         'objects': {},
-    } 
+    }
 
     def clear_doc(self, docname):
         for fullname, (fn, _l) in list(self.data['objects'].items()):
diff --git a/doc/manual/utils/dynare_lex.py b/doc/manual/utils/dynare_lex.py
index b695309aa5..4b8c23b538 100644
--- a/doc/manual/utils/dynare_lex.py
+++ b/doc/manual/utils/dynare_lex.py
@@ -33,40 +33,40 @@ class DynareLexer(RegexLexer):
     filenames = ['*.mod']
 
     commands = (
-	"dynare","var","varexo","varexo_det","parameters","change_type","model_local_variable",
-	"predetermined_variables","trend_var","log_trend_var","external_function",
-	"write_latex_original_model","write_latex_dynamic_model",
-	"write_latex_static_model","resid","initval_file","histval_file","dsample",
-	"periods","values","corr","steady","check","model_diagnostics","model_info",
-	"print_bytecode_dynamic_model"," print_bytecode_static_model",
-	"perfect_foresight_setup","perfect_foresight_solver","simul","stoch_simul",
-	"extended_path","varobs","estimation","unit_root_vars","bvar_density",
-	"model_comparison","shock_decomposition","realtime_shock_decomposition",
-	"plot_shock_decomposition","calib_smoother","forecast",
-	"conditional_forecast","plot_conditional_forecast","bvar_forecast",
-	"smoother2histval","osr","osr_params","ramsey_model","ramsey_policy",
-	"discretionary_policy","planner_objective","dynare_sensitivity",
-	"markov_switching","svar","sbvar","ms_estimation","ms_simulation",
-	"ms_compute_mdd","ms_compute_probabilities","ms_irf","ms_forecast",
-	"ms_variance_decomposition","rplot","dynatype","dynasave","set_dynare_seed",
-	"save_params_and_steady_state","load_params_and_steady_state",
-	"dynare_version","write_latex_definitions","write_latex_parameter_table",
-	"write_latex_prior_table","collect_latex_files","prior_function",
-	"posterior_function","generate_trace_plots")
+        "dynare","var","varexo","varexo_det","parameters","change_type","model_local_variable",
+        "predetermined_variables","trend_var","log_trend_var","external_function",
+        "write_latex_original_model","write_latex_dynamic_model",
+        "write_latex_static_model","resid","initval_file","histval_file","dsample",
+        "periods","values","corr","steady","check","model_diagnostics","model_info",
+        "print_bytecode_dynamic_model"," print_bytecode_static_model",
+        "perfect_foresight_setup","perfect_foresight_solver","simul","stoch_simul",
+        "extended_path","varobs","estimation","unit_root_vars","bvar_density",
+        "model_comparison","shock_decomposition","realtime_shock_decomposition",
+        "plot_shock_decomposition","calib_smoother","forecast",
+        "conditional_forecast","plot_conditional_forecast","bvar_forecast",
+        "smoother2histval","osr","osr_params","ramsey_model","ramsey_policy",
+        "discretionary_policy","planner_objective","dynare_sensitivity",
+        "markov_switching","svar","sbvar","ms_estimation","ms_simulation",
+        "ms_compute_mdd","ms_compute_probabilities","ms_irf","ms_forecast",
+        "ms_variance_decomposition","rplot","dynatype","dynasave","set_dynare_seed",
+        "save_params_and_steady_state","load_params_and_steady_state",
+        "dynare_version","write_latex_definitions","write_latex_parameter_table",
+        "write_latex_prior_table","collect_latex_files","prior_function",
+        "posterior_function","generate_trace_plots")
 
     report_commands = ("report","addPage","addSection","addGraph","addTable",
-	"addSeries","addParagraph","addVspace","write","compile")
+        "addSeries","addParagraph","addVspace","write","compile")
 
     operators = (
         "STEADY_STATE","EXPECTATION")
 
     macro_dirs = (
-	"@#includepath", "@#include", "@#define", "@#if",
-	"@#ifdef", "@#ifndef", "@#else","@#endif",
-	"@#for", "@#endfor", "@#echo", "@#error")
+        "@#includepath", "@#include", "@#define", "@#if",
+        "@#ifdef", "@#ifndef", "@#else","@#endif",
+        "@#for", "@#endfor", "@#echo", "@#error")
 
     builtin_constants = (
-	"inf", "nan")
+        "inf", "nan")
 
     tokens = {
         'root': [
@@ -74,12 +74,12 @@ class DynareLexer(RegexLexer):
 
             (words((
                 'model','steady_state_model','initval','endval','histval',
-				'shocks','mshocks','homotopy_setup','observation_trends',
-				'estimated_params','estimated_params_init','estimated_params_bounds',
-				'shock_groups','conditional_forecast_paths','optim_weights',
-				'osr_params_bounds','ramsey_constraints','irf_calibration',
-				'moment_calibration','identification','svar_identification',
-				'verbatim','end','node','cluster','paths','hooks'), prefix=r'\b', suffix=r'\s*\b'),Keyword.Reserved),
+                'shocks','mshocks','homotopy_setup','observation_trends',
+                'estimated_params','estimated_params_init','estimated_params_bounds',
+                'shock_groups','conditional_forecast_paths','optim_weights',
+                'osr_params_bounds','ramsey_constraints','irf_calibration',
+                'moment_calibration','identification','svar_identification',
+                'verbatim','end','node','cluster','paths','hooks'), prefix=r'\b', suffix=r'\s*\b'),Keyword.Reserved),
 
             (words(commands + report_commands,
                    prefix=r'\b', suffix=r'\s*\b'),  Name.Entity),
@@ -92,20 +92,19 @@ class DynareLexer(RegexLexer):
 
             (r'\s*[a-zA-Z_]\s*', Name),
 
-	    
             (r'\s*(\d+\.\d+|\d*\.\d+)([eEf][+-]?[0-9]+)?\s*', Number.Float),
             (r'\s*\d+[eEf][+-]?[0-9]+\s*', Number.Float),
             (r'\s*\d+\s*', Number.Integer),
-		
-	    	(r'"[^"]*"', String),
+
+            (r'"[^"]*"', String),
             (r"`[^`]*'", String),
-            (r"'[^']*'", String),	    
-  	
-  			(r'\s*(-|\+|\*|\/|\^)\s*', Operator),
+            (r"'[^']*'", String),
+
+            (r'\s*(-|\+|\*|\/|\^)\s*', Operator),
             (r'\s*(==|<=|>=|~=|<|>|&&|!)\s*', Operator),
 
-            (r'\s*[\[\](){}:@.,\|]\s*', Punctuation),	
-	    	(r'\s*(=|:|;|>>|#|\$)\s*', Punctuation),
-	]
+            (r'\s*[\[\](){}:@.,\|]\s*', Punctuation),
+            (r'\s*(=|:|;|>>|#|\$)\s*', Punctuation),
+        ]
 
     }
-- 
GitLab