def format_comment(self, comment): fs = '@{uline}{u.login}{default} -- {date}\n{body}\n' body = wrap(comment.body_text) date = comment.created_at.strftime('%Y-%m-%d %H:%M:%S') return fs.format(u=comment.user, uline=tc['underline'], default=tc['default'], date=date, body=body)
def print_pull(self, number): pull = self.get_pull(number) if not pull: return self.FAILURE header = self.format_short_pull(pull) body = wrap(pull.body_text) print('{0}\n{1}\n{2}\n'.format(header, sep, body)) print('{0}Files modified:{1}'.format(tc['underline'], tc['default'])) self.print_files(pull) return self.SUCCESS
def print_comments(self, number): pull = self.get_pull(number) if not pull: return self.FAILURE for c in pull.iter_comments(): fs = '@{uline}{u.login}{default} -- {date}\n{body}\n' body = '\n'.join(wrap(c.body_text)) date = c.created_at.strftime('%Y-%m-%d %H:%M:%S') print(fs.format(u=c.user, date=date, body=body, uline=tc['underline'], default=tc['default'])) return self.SUCCESS
def print_comments(self, number): pull = self.get_pull(number) if not pull: return self.FAILURE for c in pull.iter_comments(): fs = '@{uline}{u.login}{default} -- {date}\n{body}\n' body = '\n'.join(wrap(c.body_text)) date = c.created_at.strftime('%Y-%m-%d %H:%M:%S') print( fs.format(u=c.user, date=date, body=body, uline=tc['underline'], default=tc['default'])) return self.SUCCESS
def run(self, options, args): self.get_repo(options) opts, args = self.parser.parse_args(args) if opts.help: self.help() number = get_issue_number(args, self.parser, 'An issue number is required.') if number is None: return self.FAILURE issue = self.repo.issue(number) format_str = '{header}\n{sep}\n{body}\n' title = ('#{0.number}: {1[bold]}{0.title}{1[default]} - ' '@{0.user}'.format(issue, tc)) body = wrap(issue.body_text or '') print(format_str.format(header=title, sep=sep, body=body)) return self.SUCCESS
def run(self, options, args): self.get_repo(options) opts, args = self.parser.parse_args(args) if opts.help: self.help() number = get_issue_number( args, self.parser, 'An issue number is required.' ) if number is None: return self.FAILURE issue = self.repo.issue(number) format_str = '{header}\n{sep}\n{body}\n' title = ('#{0.number}: {1[bold]}{0.title}{1[default]} - ' '@{0.user}'.format(issue, tc)) body = wrap(issue.body_text or '') print(format_str.format(header=title, sep=sep, body=body)) return self.SUCCESS
def test_wrap(self): assert ''.join(wrap('foo')) == 'foo'