<s> from st2common . util import isotime <EOL> __all__ = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> def issue_to_dict ( issue ) : <EOL> result = { } <EOL> author = user_to_dict ( issue . user ) <EOL> assignee = user_to_dict ( issue . assignee ) <EOL> closed_by = user_to_dict ( issue . closed_by ) <EOL> if issue . pull_request : <EOL> is_pull_request = True <EOL> else : <EOL> is_pull_request = False <EOL> result [ '<STR_LIT:id>' ] = issue . id <EOL> result [ '<STR_LIT>' ] = issue . repository . name <EOL> result [ '<STR_LIT>' ] = author <EOL> result [ '<STR_LIT>' ] = assignee <EOL> result [ '<STR_LIT:title>' ] = issue . title <EOL> result [ '<STR_LIT:body>' ] = issue . body <EOL> result [ '<STR_LIT:url>' ] = issue . html_url <EOL> result [ '<STR_LIT:state>' ] = issue . state <EOL> result [ '<STR_LIT>' ] = is_pull_request <EOL> if issue . labels : <EOL> labels = [ label_to_dict ( label ) for label in issue . labels ] <EOL> else : <EOL> labels = [ ] <EOL> result [ '<STR_LIT>' ] = labels <EOL> if issue . created_at : <EOL> created_at = isotime . format ( issue . created_at ) <EOL> else : <EOL> created_at = None <EOL> if issue . closed_at : <EOL> closed_at = isotime . format ( issue . closed_at ) <EOL> else : <EOL> closed_at = None <EOL> result [ '<STR_LIT>' ] = created_at <EOL> result [ '<STR_LIT>' ] = closed_at <EOL> result [ '<STR_LIT>' ] = closed_by <EOL> return result <EOL> def label_to_dict ( label ) : <EOL> result = { } <EOL> result [ '<STR_LIT:name>' ] = label . name <EOL> result [ '<STR_LIT>' ] = label . color <EOL> result [ '<STR_LIT:url>' ] = label . url <EOL> return result <EOL> def user_to_dict ( user ) : <EOL> if not user : <EOL> return None <EOL> result = { } <EOL> result [ '<STR_LIT:name>' ] = user . name <EOL> result [ '<STR_LIT>' ] = user . login <EOL> return result <EOL> def team_to_dict ( team ) : <EOL> if not team : <EOL> return None <EOL> result = { } <EOL> result [ '<STR_LIT:id>' ] = team . id <EOL> result [ '<STR_LIT:name>' ] = team . name <EOL> result [ '<STR_LIT>' ] = team . members_count <EOL> return result </s>
