Repository: google/yapf

Issue:
_CreateConfigParserFromConfigString buggy for values with quotes - it captures quotes too
ver: 0.24 

steps repeat:

    yapf --style='{use_tabs: true, continuation_align_style: "valign-right"}' --style-help

gives:

    yapf: '"valign-right"' is not a valid setting for CONTINUATION_ALIGN_STYLE.

Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/21168378/badge)](https://coveralls.io/builds/21168378)

Coverage remained the same at 95.508% when pulling **cd180bd1cb6ab02b94c1b04a4cc343e11879c4d3 on yinyin:improve-continuation-valign-option-parsing** into **9546d407a4f898cd341e4e12e4b7cd50b6c5c2a2 on google:master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/21168378/badge)](https://coveralls.io/builds/21168378)

Coverage remained the same at 95.508% when pulling **cd180bd1cb6ab02b94c1b04a4cc343e11879c4d3 on yinyin:improve-continuation-valign-option-parsing** into **9546d407a4f898cd341e4e12e4b7cd50b6c5c2a2 on google:master**.

gwelymernans: Could you add a couple of test cases please?
gwelymernans: Also, please update the change log.

Patch:
diff --git a/CHANGELOG b/CHANGELOG
index 214f013..00f226f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,6 +13,8 @@
   the list that is greater than the maximum line length in the block.
 - Don't modify the vertical spacing of a line that has a comment "pylint:
   disable=line-too-long". The line is expected to be too long.
+- improved `CONTINUATION_ALIGN_STYLE` to accept quoted or underline-separated
+  option value for passing option with command line arguments.
 ### Fixed
 - When retrieving the opening bracket make sure that it's actually an opening
   bracket.
diff --git a/yapf/yapflib/style.py b/yapf/yapflib/style.py
index 8345304..f5a002a 100644
--- a/yapf/yapflib/style.py
+++ b/yapf/yapflib/style.py
@@ -437,7 +437,7 @@ def _ContinuationAlignStyleStringConverter(s):
   """Option value converter for a continuation align style string."""
   accepted_styles = ('SPACE', 'FIXED', 'VALIGN-RIGHT')
   if s:
-    r = s.upper()
+    r = s.strip('"\'').replace('_', '-').upper()
     if r not in accepted_styles:
       raise ValueError('unknown continuation align style: %r' % (s,))
   else:


Test patch:
diff --git a/yapftests/style_test.py b/yapftests/style_test.py
index ff4643e..3d4e1b1 100644
--- a/yapftests/style_test.py
+++ b/yapftests/style_test.py
@@ -27,14 +27,25 @@ from yapftests import utils
 class UtilsTest(unittest.TestCase):
 
   def testContinuationAlignStyleStringConverter(self):
-    self.assertEqual(style._ContinuationAlignStyleStringConverter(''), 'SPACE')
-    self.assertEqual(
-        style._ContinuationAlignStyleStringConverter('space'), 'SPACE')
-    self.assertEqual(
-        style._ContinuationAlignStyleStringConverter('fixed'), 'FIXED')
-    self.assertEqual(
-        style._ContinuationAlignStyleStringConverter('valign-right'),
-        'VALIGN-RIGHT')
+    for cont_align_space in ('', 'space', '"space"', '\'space\''):
+      self.assertEqual(
+          style._ContinuationAlignStyleStringConverter(cont_align_space),
+          'SPACE')
+    for cont_align_fixed in ('fixed', '"fixed"', '\'fixed\''):
+      self.assertEqual(
+          style._ContinuationAlignStyleStringConverter(cont_align_fixed),
+          'FIXED')
+    for cont_align_valignright in (
+        'valign-right',
+        '"valign-right"',
+        '\'valign-right\'',
+        'valign_right',
+        '"valign_right"',
+        '\'valign_right\'',
+    ):
+      self.assertEqual(
+          style._ContinuationAlignStyleStringConverter(cont_align_valignright),
+          'VALIGN-RIGHT')
     with self.assertRaises(ValueError) as ctx:
       style._ContinuationAlignStyleStringConverter('blahblah')
     self.assertIn("unknown continuation align style: 'blahblah'",