def output(self, file_type, columns): ''' Returns merge commit for the desired output and columns ''' if file_type == OutputType.CSV.value: return ';'.join([self.__getattribute__(name) for name in columns]) if file_type == OutputType.SCREEN.value: return ' | '.join([truncate_string(self.__getattribute__(name), self.SIZES[name], fill=True) for name in columns])
def get_header(columns, output_type): ''' Returns the header based on the columns/output type ''' if output_type == OutputType.SCREEN.value: return ' | '.join([truncate_string(name, MergeCommit.SIZES[name], fill=True).upper() for name in columns]) elif output_type == OutputType.CSV.value: return ';'.join([column.upper() for column in columns]) raise NotAcceptedOutputType(output_type)
def __init__(self, response_data): self.title = response_data['title'] self.truncated_title = truncate_string(self.title, self.TRUNCATE_SIZE) self.iid = response_data['iid'] self.id_ = response_data['id'] self.owner_name = response_data['author']['name'] self.owner_username = response_data['author']['username'] self.sha = response_data['merge_commit_sha'] self.ssha = get_short_sha(self.sha) self.merge_date = response_data['updated_at']