File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -16,21 +16,21 @@ def ConvertibleToConverter(in_file: AbstractFile) -> ConvertibleToFile:
1616
1717@converter # pyright: ignore[reportArgumentType]
1818@python .define (outputs = ["out_file" ]) # type: ignore[misc]
19- def EncodedFromTextConverter (in_file : TextFile ) -> EncodedText :
19+ def EncodedFromTextConverter (in_file : TextFile , shift : int = 1 ) -> EncodedText :
2020 contents = in_file .read_text ()
2121 # Encode by shifting ASCII codes forward by 1
22- encoded_contents = "" .join (chr (ord (c ) + 1 ) for c in contents )
22+ encoded_contents = "" .join (chr (ord (c ) + shift ) for c in contents )
2323 out_file = EncodedText .sample ()
2424 out_file .write_text (encoded_contents )
2525 return out_file
2626
2727
2828@converter # pyright: ignore[reportArgumentType]
2929@python .define (outputs = ["out_file" ]) # type: ignore[misc]
30- def EncodedToTextConverter (in_file : EncodedText ) -> TextFile :
30+ def EncodedToTextConverter (in_file : EncodedText , shift : int = 1 ) -> TextFile :
3131 contents = in_file .read_text ()
3232 # Decode by shifting ASCII codes back by 1
33- decoded_contents = "" .join (chr (ord (c ) - 1 ) for c in contents )
33+ decoded_contents = "" .join (chr (ord (c ) - shift ) for c in contents )
3434 out_file = TextFile .sample ()
3535 out_file .write_text (decoded_contents )
3636 return out_file
You can’t perform that action at this time.
0 commit comments