Skip to content

Commit

Permalink
Remove unescape_string.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark committed Mar 15, 2024
1 parent 76e7cb6 commit 251d3c9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
20 changes: 0 additions & 20 deletions edb/common/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,3 @@ def escape_string(s: str) -> str:
result = result.replace('\t', '\\t')

return result


def unescape_string(s: str) -> str:
split = s.split('\\\\')

def unescape_non_backslash(s: str) -> str:
result = s

result = result.replace('\\\'', '\'')
result = result.replace('\\\"', '\"')
result = result.replace('\\b', '\b')
result = result.replace('\\f', '\f')
result = result.replace('\\n', '\n')
result = result.replace('\\r', '\r')
result = result.replace('\\t', '\t')

return result

return '\\'.join(unescape_non_backslash(r)
for r in split)
4 changes: 0 additions & 4 deletions tests/common/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ class StringTests(unittest.TestCase):
def test_escape_string(self):
for unescaped, escaped in StringTests.unescaped_escaped_strings:
self.assertEqual(string.escape_string(unescaped), escaped)

def test_unescape_string(self):
for unescaped, escaped in StringTests.unescaped_escaped_strings:
self.assertEqual(string.unescape_string(escaped), unescaped)
3 changes: 1 addition & 2 deletions tests/test_edgeql_data_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import edgedb

from edb.common import assert_data_shape
from edb.common.string import unescape_string

from edb.testbase import server as tb
from edb.testbase import serutils
Expand Down Expand Up @@ -141,7 +140,7 @@ async def fast_forward_describe_migration(
interpolations[var_name] = var_value

for stmt in mig['proposed']['statements']:
curddl = unescape_string(stmt['text'])
curddl = stmt['text']

if interpolations:
def _replace(match, interpolations=interpolations):
Expand Down

0 comments on commit 251d3c9

Please sign in to comment.