parameters: (self, simulation_state=None, omit_transit=0,
                                input_simulation_state=None,
                                output_simulation_state=None,
                                transit_simulation_state=None,
                                strict_simulation_state=None)
return_statement: return simulation_dict
docstring: This method is used in order to give what should be
      the input_simulation_state or output_simulation_state
      depending on many parameters
docstring_summary: This method is used in order to give what should be
      the input_simulation_state or output_simulation_state
      depending on many parameters
docstring_tokens: This method is used in order to give what should be the input_simulation_state or output_simulation_state depending on many parameters
function: def _getSimulationStateDict(self, simulation_state=None, omit_transit=0,
                                input_simulation_state=None,
                                output_simulation_state=None,
                                transit_simulation_state=None,
                                strict_simulation_state=None):
      """
      This method is used in order to give what should be
      the input_simulation_state or output_simulation_state
      depending on many parameters
      """
      string_or_list = (str, list, tuple)
      # Simulation States
      # If strict_simulation_state is set, we directly put it into the dictionary
      simulation_dict = {}
      if strict_simulation_state:
        if isinstance(simulation_state, string_or_list)\
                and simulation_state:
          simulation_dict['simulation_state'] = simulation_state
      else:
        # first, we evaluate simulation_state
        sql_kw = {}
        if simulation_state and isinstance(simulation_state, string_or_list):
          if isinstance(simulation_state, str):
            sql_kw['input_simulation_state'] = [simulation_state]
            sql_kw['output_simulation_state'] = [simulation_state]
          else:
            sql_kw['input_simulation_state'] = simulation_state
            sql_kw['output_simulation_state'] = simulation_state
        # then, if omit_transit == 1, we evaluate (simulation_state -
        # transit_simulation_state) for input_simulation_state
        if omit_transit:
          if isinstance(simulation_state, string_or_list)\
                and simulation_state:
            if isinstance(transit_simulation_state, string_or_list)\
                  and transit_simulation_state:
              # when we know both are usable, we try to calculate
              # (simulation_state - transit_simulation_state)
              if isinstance(simulation_state, str):
                simulation_state = [simulation_state]
              if isinstance(transit_simulation_state, str) :
                transit_simulation_state = [transit_simulation_state]
              delivered_simulation_state_list = []
              for state in simulation_state :
                if state not in transit_simulation_state :
                  delivered_simulation_state_list.append(state)
              sql_kw['input_simulation_state'] = delivered_simulation_state_list
  
        # alternatively, the user can directly define input_simulation_state
        # and output_simulation_state
        if input_simulation_state and isinstance(input_simulation_state,
                                                  string_or_list):
          if isinstance(input_simulation_state, str):
            input_simulation_state = [input_simulation_state]
          sql_kw['input_simulation_state'] = input_simulation_state
        if output_simulation_state and isinstance(output_simulation_state,
                                                  string_or_list):
          if isinstance(output_simulation_state, str):
            output_simulation_state = [output_simulation_state]
          sql_kw['output_simulation_state'] = output_simulation_state
        # XXX In this case, we must not set sql_kw[input_simumlation_state] before
        input_simulation_state = None
        output_simulation_state = None
        if sql_kw.has_key('input_simulation_state'):
          input_simulation_state = sql_kw.get('input_simulation_state')
        if sql_kw.has_key('output_simulation_state'):
          output_simulation_state = sql_kw.get('output_simulation_state')
        if input_simulation_state is not None \
           or output_simulation_state is not None:
          sql_kw.pop('input_simulation_state',None)
          sql_kw.pop('output_simulation_state',None)
        if input_simulation_state is not None:
          if output_simulation_state is not None:
            if input_simulation_state == output_simulation_state:
              simulation_dict['simulation_state'] = input_simulation_state
            else:
              simulation_dict['input_simulation_state'] = input_simulation_state
              simulation_dict['output_simulation_state'] = output_simulation_state
          else:
            simulation_dict['input_simulation_state'] = input_simulation_state
        elif output_simulation_state is not None:
          simulation_dict['simulation_state'] = output_simulation_state
      return simulation_dict
function_tokens: def _getSimulationStateDict ( self , simulation_state = None , omit_transit = 0 , input_simulation_state = None , output_simulation_state = None , transit_simulation_state = None , strict_simulation_state = None ) : string_or_list = ( str , list , tuple ) # Simulation States # If strict_simulation_state is set, we directly put it into the dictionary simulation_dict = { } if strict_simulation_state : if isinstance ( simulation_state , string_or_list ) and simulation_state : simulation_dict [ 'simulation_state' ] = simulation_state else : # first, we evaluate simulation_state sql_kw = { } if simulation_state and isinstance ( simulation_state , string_or_list ) : if isinstance ( simulation_state , str ) : sql_kw [ 'input_simulation_state' ] = [ simulation_state ] sql_kw [ 'output_simulation_state' ] = [ simulation_state ] else : sql_kw [ 'input_simulation_state' ] = simulation_state sql_kw [ 'output_simulation_state' ] = simulation_state # then, if omit_transit == 1, we evaluate (simulation_state - # transit_simulation_state) for input_simulation_state if omit_transit : if isinstance ( simulation_state , string_or_list ) and simulation_state : if isinstance ( transit_simulation_state , string_or_list ) and transit_simulation_state : # when we know both are usable, we try to calculate # (simulation_state - transit_simulation_state) if isinstance ( simulation_state , str ) : simulation_state = [ simulation_state ] if isinstance ( transit_simulation_state , str ) : transit_simulation_state = [ transit_simulation_state ] delivered_simulation_state_list = [ ] for state in simulation_state : if state not in transit_simulation_state : delivered_simulation_state_list . append ( state ) sql_kw [ 'input_simulation_state' ] = delivered_simulation_state_list # alternatively, the user can directly define input_simulation_state # and output_simulation_state if input_simulation_state and isinstance ( input_simulation_state , string_or_list ) : if isinstance ( input_simulation_state , str ) : input_simulation_state = [ input_simulation_state ] sql_kw [ 'input_simulation_state' ] = input_simulation_state if output_simulation_state and isinstance ( output_simulation_state , string_or_list ) : if isinstance ( output_simulation_state , str ) : output_simulation_state = [ output_simulation_state ] sql_kw [ 'output_simulation_state' ] = output_simulation_state # XXX In this case, we must not set sql_kw[input_simumlation_state] before input_simulation_state = None output_simulation_state = None if sql_kw . has_key ( 'input_simulation_state' ) : input_simulation_state = sql_kw . get ( 'input_simulation_state' ) if sql_kw . has_key ( 'output_simulation_state' ) : output_simulation_state = sql_kw . get ( 'output_simulation_state' ) if input_simulation_state is not None or output_simulation_state is not None : sql_kw . pop ( 'input_simulation_state' , None ) sql_kw . pop ( 'output_simulation_state' , None ) if input_simulation_state is not None : if output_simulation_state is not None : if input_simulation_state == output_simulation_state : simulation_dict [ 'simulation_state' ] = input_simulation_state else : simulation_dict [ 'input_simulation_state' ] = input_simulation_state simulation_dict [ 'output_simulation_state' ] = output_simulation_state else : simulation_dict [ 'input_simulation_state' ] = input_simulation_state elif output_simulation_state is not None : simulation_dict [ 'simulation_state' ] = output_simulation_state return simulation_dict