MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / unescape_string

Function unescape_string

keepercommander/autocomplete.py:56–75  ·  view source on GitHub ↗

Remove escape sequences; return a literal string for matching.

(have_initial_double_quote, string)

Source from the content-addressed store, hash-verified

54
55
56def unescape_string(have_initial_double_quote, string):
57 """Remove escape sequences; return a literal string for matching."""
58 if have_initial_double_quote:
59 tuple_ = (
60 ('//', '/'),
61 ('\\"', '"'),
62 ('\\\\', '\\'),
63 )
64 else:
65 tuple_ = (
66 ('//', '\0'),
67 ('\\ ', ' '),
68 ('\\"', '"'),
69 (r"\'", "'"),
70 ('\\\\', '\\'),
71 ('\0', '/'),
72 )
73 for from_str, to_str in tuple_:
74 string = string.replace(from_str, to_str)
75 return string
76
77
78def escape_string(have_initial_double_quote, string):

Callers 1

get_completionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected