From 3628e22ca21a6791a335f4d6f3da7cae607aa210 Mon Sep 17 00:00:00 2001 From: Clayton Gearhart <75439269+claytongearhart@users.noreply.github.com> Date: Mon, 14 Aug 2023 03:38:02 -0400 Subject: [PATCH] Put python object definition and assignment on same line (#3057) Where there was an object initialization immediately followed by assignment I condensed it to one line, which seems to be the convention looking at other files. I also deleted the repetition of 'of' in some c++ comments because it was grammatically incorrect. --------- Co-authored-by: Clayton Gearhart --- github_tools/pr_comments.py | 5 ++--- migrate_cpp/rewriter.h | 4 ++-- scripts/fix_cc_deps.py | 7 ++++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/github_tools/pr_comments.py b/github_tools/pr_comments.py index 168d927eec08..7c4803b09cd3 100755 --- a/github_tools/pr_comments.py +++ b/github_tools/pr_comments.py @@ -239,15 +239,14 @@ class _Thread: def format(self, long: bool) -> str: """Formats the review thread with comments.""" - lines = [] - lines.append( + lines = [ "%s\n - line %d; %s" % ( self.url, self.line, ("resolved" if self.is_resolved else "unresolved"), ) - ) + ] if self.diff_url: lines.append(" - diff: %s" % self.diff_url) for comment in self.comments: diff --git a/migrate_cpp/rewriter.h b/migrate_cpp/rewriter.h index aeb2e8b69f4a..381fa413cd01 100644 --- a/migrate_cpp/rewriter.h +++ b/migrate_cpp/rewriter.h @@ -174,7 +174,7 @@ class RewriteBuilder : public clang::RecursiveASTVisitor { }; // An `ASTConsumer` which, when executed, populates a `std::string` with the -// text of a Carbon source file which is a best approximation of of the +// text of a Carbon source file which is a best approximation of the // semantics of the corresponding C++ translation unit defined by the consumed // AST. class MigrationConsumer : public clang::ASTConsumer { @@ -193,7 +193,7 @@ class MigrationConsumer : public clang::ASTConsumer { // An `ASTFrontendAction` which constructs a `MigrationConsumer` and invokes it // on an AST, populating a `std::string` with the text of a Carbon source file -// which is a best approximation of of the semantics of the corresponding C++ +// which is a best approximation of the semantics of the corresponding C++ // translation unit defined by the consumed AST. class MigrationAction : public clang::ASTFrontendAction { public: diff --git a/scripts/fix_cc_deps.py b/scripts/fix_cc_deps.py index 97ab56d8410e..e03c9bad957b 100755 --- a/scripts/fix_cc_deps.py +++ b/scripts/fix_cc_deps.py @@ -251,9 +251,10 @@ def main() -> None: external_rules = get_rules(bazel, external_repo_query, True) print("Building header map...") - header_to_rule_map: Dict[str, Set[str]] = {} - header_to_rule_map["gmock/gmock.h"] = {"@com_google_googletest//:gtest"} - header_to_rule_map["gtest/gtest.h"] = {"@com_google_googletest//:gtest"} + header_to_rule_map: Dict[str, Set[str]] = { + "gmock/gmock.h": {"@com_google_googletest//:gtest"}, + "gtest/gtest.h": {"@com_google_googletest//:gtest"}, + } map_headers(header_to_rule_map, carbon_rules) map_headers(header_to_rule_map, external_rules)