parameters: (self, enable)
return_statement: return True
docstring: Sets or removes the device java assertions property.
  
      Args:
        enable: If True the property will be set.
  
      Returns:
        True if the file was modified (reboot is required for it to take effect).
docstring_summary: Sets or removes the device java assertions property.
docstring_tokens: Sets or removes the device java assertions property .
function: def SetJavaAssertsEnabled(self, enable):
      """Sets or removes the device java assertions property.
  
      Args:
        enable: If True the property will be set.
  
      Returns:
        True if the file was modified (reboot is required for it to take effect).
      """
      # First ensure the desired property is persisted.
      temp_props_file = tempfile.NamedTemporaryFile()
      properties = ''
      if self._adb.Pull(LOCAL_PROPERTIES_PATH, temp_props_file.name):
        properties = file(temp_props_file.name).read()
      re_search = re.compile(r'^\s*' + re.escape(JAVA_ASSERT_PROPERTY) +
                             r'\s*=\s*all\s*$', re.MULTILINE)
      if enable != bool(re.search(re_search, properties)):
        re_replace = re.compile(r'^\s*' + re.escape(JAVA_ASSERT_PROPERTY) +
                                r'\s*=\s*\w+\s*$', re.MULTILINE)
        properties = re.sub(re_replace, '', properties)
        if enable:
          properties += '\n%s=all\n' % JAVA_ASSERT_PROPERTY
  
        file(temp_props_file.name, 'w').write(properties)
        self._adb.Push(temp_props_file.name, LOCAL_PROPERTIES_PATH)
  
      # Next, check the current runtime value is what we need, and
      # if not, set it and report that a reboot is required.
      was_set = 'all' in self.system_properties[JAVA_ASSERT_PROPERTY]
      if was_set == enable:
        return False
      self.system_properties[JAVA_ASSERT_PROPERTY] = enable and 'all' or ''
      return True
function_tokens: def SetJavaAssertsEnabled ( self , enable ) : # First ensure the desired property is persisted. temp_props_file = tempfile . NamedTemporaryFile ( ) properties = '' if self . _adb . Pull ( LOCAL_PROPERTIES_PATH , temp_props_file . name ) : properties = file ( temp_props_file . name ) . read ( ) re_search = re . compile ( r'^\s*' + re . escape ( JAVA_ASSERT_PROPERTY ) + r'\s*=\s*all\s*$' , re . MULTILINE ) if enable != bool ( re . search ( re_search , properties ) ) : re_replace = re . compile ( r'^\s*' + re . escape ( JAVA_ASSERT_PROPERTY ) + r'\s*=\s*\w+\s*$' , re . MULTILINE ) properties = re . sub ( re_replace , '' , properties ) if enable : properties += '\n%s=all\n' % JAVA_ASSERT_PROPERTY file ( temp_props_file . name , 'w' ) . write ( properties ) self . _adb . Push ( temp_props_file . name , LOCAL_PROPERTIES_PATH ) # Next, check the current runtime value is what we need, and # if not, set it and report that a reboot is required. was_set = 'all' in self . system_properties [ JAVA_ASSERT_PROPERTY ] if was_set == enable : return False self . system_properties [ JAVA_ASSERT_PROPERTY ] = enable and 'all' or '' return True