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 (
@@ -68,7 +70,6 @@ def round_trip_stabler(
6870
6971
7072class TestStability :
71-
7273 def test_blockseq1 (self ):
7374 round_trip (
7475 """
@@ -101,8 +102,8 @@ def test_blockseq3(self):
101102 """
102103 )
103104
104- class TestStabilityStabler :
105105
106+ class TestStabilityStabler :
106107 def test_blockseq1 (self ):
107108 round_trip_stabler (
108109 """
0 commit comments