proxygen
shell_quoting.ShellQuoted Class Reference
Inheritance diagram for shell_quoting.ShellQuoted:

Public Member Functions

def __new__ (cls, s)
 
def __str__ (self)
 
def __repr__ (self)
 
def format (self, kwargs)
 
def __new__ (cls, s)
 
def __str__ (self)
 
def __repr__ (self)
 
def format (self, kwargs)
 
def __new__ (cls, s)
 
def __str__ (self)
 
def __repr__ (self)
 
def format (self, kwargs)
 
def __new__ (cls, s)
 
def __str__ (self)
 
def __repr__ (self)
 
def format (self, kwargs)
 

Detailed Description

Wrap a string with this to make it transparent to shell_quote().  It
will almost always suffice to use ShellQuoted.format(), path_join(),
or shell_join().

If you really must, use raw_shell() to access the raw string.

Definition at line 26 of file shell_quoting.py.

Member Function Documentation

def shell_quoting.ShellQuoted.__new__ (   cls,
  s 
)

Definition at line 37 of file shell_quoting.py.

Referenced by shell_quoting.ShellQuoted.__new__().

37  def __new__(cls, s):
38  'No need to nest ShellQuoted.'
39  return super(ShellQuoted, cls).__new__(
40  cls, s.do_not_use_raw_str if isinstance(s, ShellQuoted) else s
41  )
42 
def shell_quoting.ShellQuoted.__new__ (   cls,
  s 
)

Definition at line 37 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__new__().

37  def __new__(cls, s):
38  'No need to nest ShellQuoted.'
39  return super(ShellQuoted, cls).__new__(
40  cls, s.do_not_use_raw_str if isinstance(s, ShellQuoted) else s
41  )
42 
def shell_quoting.ShellQuoted.__new__ (   cls,
  s 
)

Definition at line 37 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__new__().

37  def __new__(cls, s):
38  'No need to nest ShellQuoted.'
39  return super(ShellQuoted, cls).__new__(
40  cls, s.do_not_use_raw_str if isinstance(s, ShellQuoted) else s
41  )
42 
def shell_quoting.ShellQuoted.__new__ (   cls,
  s 
)

Definition at line 37 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__new__().

37  def __new__(cls, s):
38  'No need to nest ShellQuoted.'
39  return super(ShellQuoted, cls).__new__(
40  cls, s.do_not_use_raw_str if isinstance(s, ShellQuoted) else s
41  )
42 
def shell_quoting.ShellQuoted.__repr__ (   self)

Definition at line 49 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__repr__(), and shell_quoting.ShellQuoted.format().

49  def __repr__(self):
50  return '{0}({1})'.format(
51  self.__class__.__name__, repr(self.do_not_use_raw_str)
52  )
53 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__repr__ (   self)

Definition at line 49 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__repr__(), and shell_quoting.ShellQuoted.format().

49  def __repr__(self):
50  return '{0}({1})'.format(
51  self.__class__.__name__, repr(self.do_not_use_raw_str)
52  )
53 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__repr__ (   self)

Definition at line 49 of file shell_quoting.py.

References shell_quoting.ShellQuoted.format().

Referenced by shell_quoting.ShellQuoted.__repr__().

49  def __repr__(self):
50  return '{0}({1})'.format(
51  self.__class__.__name__, repr(self.do_not_use_raw_str)
52  )
53 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__repr__ (   self)

Definition at line 49 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__repr__(), and shell_quoting.ShellQuoted.format().

49  def __repr__(self):
50  return '{0}({1})'.format(
51  self.__class__.__name__, repr(self.do_not_use_raw_str)
52  )
53 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__str__ (   self)

Definition at line 43 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__str__(), and shell_quoting.ShellQuoted.format().

43  def __str__(self):
44  raise RuntimeError(
45  'One does not simply convert {0} to a string -- use path_join() '
46  'or ShellQuoted.format() instead'.format(repr(self))
47  )
48 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__str__ (   self)

Definition at line 43 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__str__(), and shell_quoting.ShellQuoted.format().

43  def __str__(self):
44  raise RuntimeError(
45  'One does not simply convert {0} to a string -- use path_join() '
46  'or ShellQuoted.format() instead'.format(repr(self))
47  )
48 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__str__ (   self)

Definition at line 43 of file shell_quoting.py.

References shell_quoting.ShellQuoted.format().

Referenced by shell_quoting.ShellQuoted.__str__().

43  def __str__(self):
44  raise RuntimeError(
45  'One does not simply convert {0} to a string -- use path_join() '
46  'or ShellQuoted.format() instead'.format(repr(self))
47  )
48 
def format(self, kwargs)
def shell_quoting.ShellQuoted.__str__ (   self)

Definition at line 43 of file shell_quoting.py.

References shell_quoting.ShellQuoted.__str__(), and shell_quoting.ShellQuoted.format().

43  def __str__(self):
44  raise RuntimeError(
45  'One does not simply convert {0} to a string -- use path_join() '
46  'or ShellQuoted.format() instead'.format(repr(self))
47  )
48 
def format(self, kwargs)
def shell_quoting.ShellQuoted.format (   self,
  kwargs 
)
Use instead of str.format() when the arguments are either
`ShellQuoted()` or raw strings needing to be `shell_quote()`d.

Positional args are deliberately not supported since they are more
error-prone.

Definition at line 54 of file shell_quoting.py.

References shell_quoting.shell_quote().

Referenced by shell_quoting.ShellQuoted.__repr__(), shell_quoting.ShellQuoted.__str__(), and shell_quoting.ShellQuoted.format().

54  def format(self, **kwargs):
55  '''
56 
57  Use instead of str.format() when the arguments are either
58  `ShellQuoted()` or raw strings needing to be `shell_quote()`d.
59 
60  Positional args are deliberately not supported since they are more
61  error-prone.
62 
63  '''
64  return ShellQuoted(self.do_not_use_raw_str.format(**dict(
65  (k, shell_quote(v).do_not_use_raw_str) for k, v in kwargs.items()
66  )))
67 
68 
def shell_quote(s)
def format(self, kwargs)
def shell_quoting.ShellQuoted.format (   self,
  kwargs 
)
Use instead of str.format() when the arguments are either
`ShellQuoted()` or raw strings needing to be `shell_quote()`d.

Positional args are deliberately not supported since they are more
error-prone.

Definition at line 54 of file shell_quoting.py.

References shell_quoting.ShellQuoted.format(), shell_quoting.path_join(), shell_quoting.raw_shell(), replace(), shell_quoting.shell_comment(), shell_quoting.shell_join(), and shell_quoting.shell_quote().

54  def format(self, **kwargs):
55  '''
56 
57  Use instead of str.format() when the arguments are either
58  `ShellQuoted()` or raw strings needing to be `shell_quote()`d.
59 
60  Positional args are deliberately not supported since they are more
61  error-prone.
62 
63  '''
64  return ShellQuoted(self.do_not_use_raw_str.format(**dict(
65  (k, shell_quote(v).do_not_use_raw_str) for k, v in kwargs.items()
66  )))
67 
68 
def shell_quote(s)
def format(self, kwargs)
def shell_quoting.ShellQuoted.format (   self,
  kwargs 
)
Use instead of str.format() when the arguments are either
`ShellQuoted()` or raw strings needing to be `shell_quote()`d.

Positional args are deliberately not supported since they are more
error-prone.

Definition at line 54 of file shell_quoting.py.

References shell_quoting.ShellQuoted.format(), shell_quoting.path_join(), shell_quoting.raw_shell(), replace(), shell_quoting.shell_comment(), shell_quoting.shell_join(), and shell_quoting.shell_quote().

54  def format(self, **kwargs):
55  '''
56 
57  Use instead of str.format() when the arguments are either
58  `ShellQuoted()` or raw strings needing to be `shell_quote()`d.
59 
60  Positional args are deliberately not supported since they are more
61  error-prone.
62 
63  '''
64  return ShellQuoted(self.do_not_use_raw_str.format(**dict(
65  (k, shell_quote(v).do_not_use_raw_str) for k, v in kwargs.items()
66  )))
67 
68 
def shell_quote(s)
def format(self, kwargs)
def shell_quoting.ShellQuoted.format (   self,
  kwargs 
)
Use instead of str.format() when the arguments are either
`ShellQuoted()` or raw strings needing to be `shell_quote()`d.

Positional args are deliberately not supported since they are more
error-prone.

Definition at line 54 of file shell_quoting.py.

References shell_quoting.ShellQuoted.format(), shell_quoting.path_join(), shell_quoting.raw_shell(), replace(), shell_quoting.shell_comment(), shell_quoting.shell_join(), and shell_quoting.shell_quote().

54  def format(self, **kwargs):
55  '''
56 
57  Use instead of str.format() when the arguments are either
58  `ShellQuoted()` or raw strings needing to be `shell_quote()`d.
59 
60  Positional args are deliberately not supported since they are more
61  error-prone.
62 
63  '''
64  return ShellQuoted(self.do_not_use_raw_str.format(**dict(
65  (k, shell_quote(v).do_not_use_raw_str) for k, v in kwargs.items()
66  )))
67 
68 
def shell_quote(s)
def format(self, kwargs)

The documentation for this class was generated from the following file: