<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import cascading . pipe <EOL> import cascading . pipe . cogroup <EOL> import cascading . operation <EOL> from pycascading . pipe import Operation , coerce_to_fields , _Stackable <EOL> class CoGroup ( Operation ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> Operation . __init__ ( self ) <EOL> self . __args = args <EOL> self . __kwargs = kwargs <EOL> def __create_args ( self , <EOL> group_name = None , <EOL> pipes = None , group_fields = None , declared_fields = None , <EOL> result_group_fields = None , joiner = None , <EOL> pipe = None , num_self_joins = None , <EOL> lhs = None , lhs_group_fields = None , <EOL> rhs = None , rhs_group_fields = None ) : <EOL> if self . __args : <EOL> group_fields = [ coerce_to_fields ( f ) for f in self . __args [ <NUM_LIT:0> ] ] <EOL> args = [ ] <EOL> if group_name : <EOL> args . append ( str ( group_name ) ) <EOL> if lhs : <EOL> args . append ( lhs . get_assembly ( ) ) <EOL> args . append ( coerce_to_fields ( lhs_group_fields ) ) <EOL> args . append ( rhs . get_assembly ( ) ) <EOL> args . append ( coerce_to_fields ( rhs_group_fields ) ) <EOL> if declared_fields : <EOL> args . append ( coerce_to_fields ( declared_fields ) ) <EOL> if result_group_fields : <EOL> args . append ( coerce_to_fields ( result_group_fields ) ) <EOL> if joiner : <EOL> args . append ( joiner ) <EOL> elif pipes : <EOL> args . append ( [ p . get_assembly ( ) for p in pipes ] ) <EOL> if group_fields : <EOL> args . append ( [ coerce_to_fields ( f ) for f in group_fields ] ) <EOL> if declared_fields : <EOL> args . append ( coerce_to_fields ( declared_fields ) ) <EOL> if result_group_fields : <EOL> args . append ( coerce_to_fields ( result_group_fields ) ) <EOL> else : <EOL> args . append ( None ) <EOL> if joiner is None : <EOL> joiner = cascading . pipe . cogroup . InnerJoin ( ) <EOL> args . append ( joiner ) <EOL> elif pipe : <EOL> args . append ( pipe . get_assembly ( ) ) <EOL> args . append ( coerce_to_fields ( group_fields ) ) <EOL> args . append ( int ( num_self_joins ) ) <EOL> if declared_fields : <EOL> args . append ( coerce_to_fields ( declared_fields ) ) <EOL> if result_group_fields : <EOL> args . append ( coerce_to_fields ( result_group_fields ) ) <EOL> if joiner : <EOL> args . append ( joiner ) <EOL> return args <EOL> def _create_with_parent ( self , parent ) : <EOL> if isinstance ( parent , _Stackable ) : <EOL> args = self . __create_args ( pipes = parent . stack , ** self . __kwargs ) <EOL> else : <EOL> args = self . __create_args ( pipe = parent , ** self . __kwargs ) <EOL> return cascading . pipe . CoGroup ( * args ) <EOL> def inner_join ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ '<STR_LIT>' ] = cascading . pipe . cogroup . InnerJoin ( ) <EOL> if not '<STR_LIT>' in kwargs : <EOL> kwargs [ '<STR_LIT>' ] = None <EOL> return CoGroup ( * args , ** kwargs ) <EOL> def outer_join ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ '<STR_LIT>' ] = cascading . pipe . cogroup . OuterJoin ( ) <EOL> if not '<STR_LIT>' in kwargs : <EOL> kwargs [ '<STR_LIT>' ] = None <EOL> return CoGroup ( * args , ** kwargs ) <EOL> def left_outer_join ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ '<STR_LIT>' ] = cascading . pipe . cogroup . LeftJoin ( ) <EOL> if not '<STR_LIT>' in kwargs : <EOL> kwargs [ '<STR_LIT>' ] = None <EOL> return CoGroup ( * args , ** kwargs ) <EOL> def right_outer_join ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> kwargs [ '<STR_LIT>' ] = cascading . pipe . cogroup . RightJoin ( ) <EOL> if not '<STR_LIT>' in kwargs : <EOL> kwargs [ '<STR_LIT>' ] = None <EOL> return CoGroup ( * args , ** kwargs ) </s>
