1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6 A 2to3 fixer that converts all string literals to use double quotes.
8 Strings that contain double quotes will not be modified. Prefixed string
9 literals will also not be modified. This affects both single-quoted strings
10 and triple-single-quoted strings.
14 from lib2to3.fixer_base import BaseFix
15 from lib2to3.pgen2 import token
18 class FixDoubleQuoteStrings(BaseFix):
21 _accept_type = token.STRING
23 def match(self, node):
24 res = node.value.startswith("'") and '"' not in node.value[1:-1]
27 def transform(self, node, results):
28 node.value = node.value.replace("'", '"')