def combine_issues( nvim: Nvim, markdown_issues: List[GitHubIssue], api_issues: List[GitHubIssue] ) -> List[GitHubIssue]: """combine_issues Takes both markdown and GitHub API issues and combines them. Treats the GitHub version as the truth, and keeps around any issues with an edit or new tag. """ # Default to using the API version. combined_issues: List[GitHubIssue] = api_issues # Then, copy over any issues/comments with a new/edit tag, or that are missing. for issue in markdown_issues: api_issue_index: Optional[int] = get_issue_index(api_issues, issue.number) # If the issue doesn't exist at all, we need to add the whole thing. if api_issue_index is None: combined_issues.append(issue) continue api_issue: GitHubIssue = combined_issues[api_issue_index] # Add the new/edited comments for index, comment in enumerate(issue.all_comments): if len(api_issue.all_comments) <= index: api_issue.all_comments.append(comment) continue api_comment: GitHubIssueComment = api_issue.all_comments[index] # If we've got a new comment in the markdown, add it. if "new" in comment.tags: comment.number = len(api_issue.all_comments) api_issue.all_comments.append(comment) continue # If we've got an edited comment, where the online matches the # markdown version, keep the markdown comment around. if "edit" in comment.tags and comment.updated_at == api_comment.updated_at: api_issue.all_comments[index] = comment continue # If we've got an edited comment, where the online is newer than the # markdown version, add the markdown comment, but label it as conflicted. if "edit" in comment.tags and comment.updated_at < api_comment.updated_at: comment.number = len(api_issue.all_comments) comment.tags.append("conflict") api_issue.all_comments.append(comment) nvim.out_write(f"Updated {len(combined_issues) - len(markdown_issues)} issues.\n") return combined_issues
def buffered_info_message(nvim: Nvim, message: str) -> None: """buffered_info_message A helper function to return an info message to the user. This is buffered, so this will not print anything until a final newline (\n) is sent. """ nvim.out_write(f"{message}")
def debug(vim: Nvim, expr: typing.Any) -> None: if hasattr(vim, 'out_write'): string = (expr if isinstance(expr, str) else str(expr)) vim.out_write('[denite] ' + string + '\n') else: print(expr)
def debug(vim: Nvim, expr: typing.Any) -> None: if hasattr(vim, 'out_write'): string = (expr if isinstance(expr, str) else str(expr)) vim.out_write('[deoplete] ' + string + '\n') else: vim.call('deoplete#util#print_debug', expr)
def debug(vim: Nvim, expr: typing.Any) -> None: if hasattr(vim, 'out_write'): vim.out_write(f'[deoplete] {expr}\n') else: vim.call('deoplete#util#print_debug', expr)
def debug(vim: Nvim, expr): if hasattr(vim, 'out_write'): string = (expr if isinstance(expr, str) else str(expr)) return vim.out_write('[denite] ' + string + '\n') else: print(expr)