Changes between Version 13 and Version 14 of DevNotes/DevGuide/CodingRules


Ignore:
Timestamp:
May 30, 2016 5:56:37 AM (8 years ago)
Author:
wojciech
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • DevNotes/DevGuide/CodingRules

    v13 v14  
    196196The proposed access to the core functionality should be consistent for all perspectives and straightforward to use. 
    197197 
    198     All known input arguments should be set in __init__, during instantiation, with proper checks 
    199     Additional input data can be set directly through the @property decorator 
    200  
     198    * All known input arguments should be set in __init__, during instantiation, with proper checks 
     199    * Additional input data can be set directly through the @property decorator 
     200 
     201        {{{ 
     202        #!div style="font-size: 80%" 
    201203        Getters: 
    202          @property 
     204        {{{#!python         
     205        @property 
    203206               def intensity(self): 
    204207                     return self.wave.intensity 
    205  
     208        }}} 
     209        }}} 
    206210          
    207  
     211        {{{ 
     212        #!div style="font-size: 80%" 
    208213        Setters: 
    209           @intensity.setter 
     214        {{{#!python         
     215        @intensity.setter 
    210216               def intensity(self, value): 
    211217                    self.wave.set_intensity(intensity) 
    212     All user accessible input/output data should be available through getters 
     218        }}} 
     219        }}} 
     220    * All user accessible input/output data should be available through getters 
    213221     __getattr__ and __setattr__ should be avoided. 
    214     Main functionality should be exposed as a method with easy to understand name, e.g. calculate() and should return the results object/structure 
    215     When defining the interface, type hints are an important part of the definition. Type hints are described in PEP-484 https://www.python.org/dev/peps/pep-0484 and should be added for all API methods. 
    216  
     222    * Main functionality should be exposed as a method with easy to understand name, e.g. calculate() and should return the results object/structure 
     223    * When defining the interface, type hints are an important part of the definition. Type hints are described in PEP-484 https://www.python.org/dev/peps/pep-0484 and should be added for all API methods. 
     224 
     225    {{{ 
     226    #!div style="font-size: 80%" 
     227    {{{#!python             
    217228    def fit(self, msg_q=None, q=None, handler=None, curr_thread=None, ftol=1.49012e-8, reset_flag=False): 
    218229           # type: (CalcThread.queue, CalcThread.queue, FitHandler, CalcThread, float, bool) -> Union[CalcThread.queue, FResult] 
    219  
    220  
    221     In cases where several pieces of information are calculated at the same time, a list of outputs, a dictionary, or an output object that contains the computed data should be returned 
    222     Error codes from a method should never be returned - use exceptions 
     230    }}} 
     231    }}} 
     232 
     233    * In cases where several pieces of information are calculated at the same time, a list of outputs, a dictionary, or an output object that contains the computed data should be returned 
     234    * Error codes from a method should never be returned - use exceptions