� ɍ�Xc @ s� d d l Te d � Z e d � Z e d � Z e d � Z e d � Z d d l m Z d d l Td � Z d � Z e d � Z e d � Z d d e d � Z d d e e d � Z e d � Z e d � Z d � Z d S( i����( t *i i i i i ( t ParentLibGAPc C sP | d k rL d t | � k rL | j � rI | t j d � k rF d SqI qL n | S( s� this function converts the gap boolean fail into a None object INPUT: - an arbtrary gap_element OUTPUT: the element itself or None if it is the gap-boolean fail. t is_boolt failN( t Nonet dirR t libgapt eval( t gap_element( ( s lib/utils_gap_interface.pyt gap_result; s c C s� y | j � } Wn t | � } n Xt | j | � � } | d k rZ t d | � � n y | | j � � } Wn | | � } n X| S( s� This function can be used to converts a gap group map which was defined by the gap functions like 'GroupHomomorphismByImages' or 'IsomorhismPermGroup' or others having an ImageElm attribute into a sage function object If you don't see this well formatted type sage: print gap_group_map.__doc__ INPUT: - "groupEle": an element of the source group, whose image should be obtained, as a sage object. - "GroupTo": the target group as a sage object - "gapHom": the gap homomorphism which should be applied to groupEle and which has been defined by a gap functions like 'GroupHomomorphismByImages' or 'IsomorhismPermGroup' OUTPUT: the value of groupEle under gap_hom as object of GroupTo RAISE: - RuntimeError: "gap cannot compute image of %s" If gap fails to compute the image USAGE: if you have defined a target group 'my_target_group' in your programm and a gap function 'my_gap_hom' then you can obtain a sage function object by setting def my_group_map( groupEle ): return gap_group_map( groupEle, my_target_group, my_gap_hom ) EXAMPLE: isoToPerm = Group_gap.IsomorphismPermGroup() permGens = isoToPerm.Image().GeneratorsOfGroup().sage() PermGroup = PermutationGroup( permGens ) def groupIso( groupEle ): return gap_group_map( groupEle, PermGroup, isoToPerm ) AUTHOR - Sebastian Oehms, Sept. 2016 s gap cannot compute image of %sN( t gapR t ImageElmR t RuntimeErrort sage( t groupElet GroupTot gapHomt groupEle_gapt imGroupEle_gapt imGroupEle( ( s lib/utils_gap_interface.pyt gap_group_mapV s 3c C s� t d | � } | j d d d t j � y t | | � | � } Wn&