Lines Matching refs:s
47 def shell_quote(s): argument
74 if isinstance(s, bytes):
75 s = s.encode('utf-8')
78 for c in s:
82 return s if s else u"''"
85 if "'" not in s:
86 return u"'%s'" % s
91 if c in s:
92 s = s.replace(c, r'\%s' % c)
93 return u'"%s"' % s
96 def shell_unquote(s): argument
108 if not s:
111 if s[0] == "'":
112 return s[1:-1]
114 if s[0] != '"':
115 return s
117 s = s[1:-1]
120 while i < len(s) - 1:
122 if s[i] == '\\' and s[i + 1] in _SHELL_ESCAPE_CHARS:
124 output += s[i]
126 return output + s[i] if i < len(s) else output
160 s = sval.lower()
161 if s in ('yes', 'y', '1', 'true'):
163 if s in ('no', 'n', '0', 'false'):