Skip to content

Commit

Permalink
Ensure nothing else changed
Browse files Browse the repository at this point in the history
  • Loading branch information
prozacchiwawa committed Apr 17, 2024
1 parent 995715a commit 8672f67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/classic/clvm/__type_compatibility__.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn vec_to_string(r: &[u8]) -> String {
* @see https://github.com/python/cpython/blob/main/Objects/bytesobject.c#L1337
* @param {Uint8Array} r - byteArray to stringify
*/
pub fn pybytes_repr(r: &[u8], dquoted: bool) -> String {
pub fn pybytes_repr(r: &[u8], dquoted: bool, full_repr: bool) -> String {
let mut squotes = 0;
let mut dquotes = 0;
for b in r.iter() {
Expand All @@ -59,7 +59,7 @@ pub fn pybytes_repr(r: &[u8], dquoted: bool) -> String {

for b in r.iter() {
let c = *b as char;
if c == quote {
if c == quote || (c == '\\' && full_repr) {
s = (s + "\\") + char_to_string(c).as_str();
} else if c == '\t' {
s += "\\t";
Expand Down Expand Up @@ -172,11 +172,11 @@ impl Bytes {
}

pub fn to_formal_string(&self) -> String {
pybytes_repr(&self._b, true)
pybytes_repr(&self._b, true, false)
}

pub fn pybytes(&self) -> String {
pybytes_repr(&self._b, false)
pybytes_repr(&self._b, false, true)
}

pub fn hex(&self) -> String {
Expand Down Expand Up @@ -209,7 +209,7 @@ impl Bytes {

impl Display for Bytes {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
fmt.write_str(&pybytes_repr(&self._b, false))?;
fmt.write_str(&pybytes_repr(&self._b, false, true))?;
Ok(())
}
}
Expand Down

0 comments on commit 8672f67

Please sign in to comment.