1+ import io
2+ from typing import Any , Dict , List , Text # NOQA
13
24import pytest
3- import io
4- import ruyaml # NOQA
5- from .roundtrip import round_trip , dedent
65
6+ import ruyaml # NOQA
77from ruyaml import YAML
8- from ruyaml .util import load_yaml_guess_indent
9- from ruyaml .scalarbool import ScalarBoolean
108from ruyaml .comments import CommentedSeq
11- from ruyaml .representer import RoundTripRepresenter , ScalarNode
129from ruyaml .constructor import RoundTripConstructor
13- from typing import Text , Any , Dict , List # NOQA
10+ from ruyaml .representer import RoundTripRepresenter , ScalarNode
11+ from ruyaml .scalarbool import ScalarBoolean
12+ from ruyaml .util import load_yaml_guess_indent
13+
14+ from .roundtrip import dedent , round_trip
1415
1516
1617class ScalarNodePositioned (ScalarNode ):
1718 lc_position = None
1819
1920
2021class ScalarBooleanStable (ScalarBoolean ):
21-
2222 def __new__ (cls : Any , boolval , origrepr , anchor = None ) -> Any :
2323 b = ScalarBoolean .__new__ (cls , boolval , anchor = anchor )
2424 b .original_bool_repr = origrepr
2525 return b
2626
2727
28- #def represent_list2(self, data):
28+ # def represent_list2(self, data):
2929# dedede
3030# RoundTripRepresenter.add_representer(CommentedSeq, represent_list2)
3131
@@ -36,7 +36,9 @@ class BetterRoundTripConstructor(RoundTripConstructor):
3636
3737class BetterRoundTripRepresenter (RoundTripRepresenter ):
3838 def represent_bool (self , data , anchor = None ):
39- ret = self .represent_scalar ('tag:yaml.org,2002:bool' , data .original_bool_repr , anchor = anchor )
39+ ret = self .represent_scalar (
40+ 'tag:yaml.org,2002:bool' , data .original_bool_repr , anchor = anchor
41+ )
4042 return ret
4143
4244 def TOTO_represent_sequence (self , tag , data ):
@@ -46,8 +48,8 @@ def TOTO_represent_sequence(self, tag, data):
4648 local_block_seq_ident = - 1
4749
4850
49- #BetterRoundTripConstructor.add_constructor('tag:yaml.org,2002:bool', BetterRoundTripConstructor.construct_yaml_bool)
50- #BetterRoundTripRepresenter.add_representer(ScalarBooleanStable, BetterRoundTripRepresenter.represent_bool)
51+ # BetterRoundTripConstructor.add_constructor('tag:yaml.org,2002:bool', BetterRoundTripConstructor.construct_yaml_bool)
52+ # BetterRoundTripRepresenter.add_representer(ScalarBooleanStable, BetterRoundTripRepresenter.represent_bool)
5153
5254
5355def round_trip_stabler (
@@ -60,8 +62,8 @@ def round_trip_stabler(
6062 yaml = ruyaml .YAML ()
6163 yaml .preserve_quotes = True
6264 yaml .preserve_bools = True
63- #yaml.Constructor = BetterRoundTripConstructor
64- #yaml.Representer = BetterRoundTripRepresenter
65+ # yaml.Constructor = BetterRoundTripConstructor
66+ # yaml.Representer = BetterRoundTripRepresenter
6567 data = yaml .load (doutp )
6668 buf = io .StringIO ()
6769 yaml .dump (data , stream = buf )
@@ -70,7 +72,6 @@ def round_trip_stabler(
7072
7173
7274class TestStability :
73-
7475 def test_lowercase_boolean (self ):
7576 round_trip (
7677 """
0 commit comments