MCPcopy Create free account
hub / github.com/apache/impala / _replace_history_delimiters

Method _replace_history_delimiters

shell/impala_shell/impala_shell.py:1888–1904  ·  view source on GitHub ↗

Replaces source_delim with target_delim for all items in history. Read all the items from history into a local list. Clear the history and copy them back after doing the transformation.

(self, src_delim, tgt_delim)

Source from the content-addressed store, hash-verified

1886 return strip_leading_comment_filter.comment, stripped_line
1887
1888 def _replace_history_delimiters(self, src_delim, tgt_delim):
1889 """Replaces source_delim with target_delim for all items in history.
1890
1891 Read all the items from history into a local list. Clear the history and copy them
1892 back after doing the transformation.
1893 """
1894 history_len = self.readline.get_current_history_length()
1895 # load the history and replace the shell's delimiter with EOL
1896 history_items = map(self.readline.get_history_item, xrange(1, history_len + 1))
1897 if sys.version_info.major == 2:
1898 src_delim = src_delim.encode('utf-8')
1899 tgt_delim = tgt_delim.encode('utf-8')
1900 history_items = [item.replace(src_delim, tgt_delim) for item in history_items]
1901 # Clear the original history and replace it with the mutated history.
1902 self.readline.clear_history()
1903 for history_item in history_items:
1904 self.readline.add_history(history_item)
1905
1906 def default(self, line):
1907 """Called for any command that doesn't have a do_*() method. Sends the command

Callers 2

__init__Method · 0.95
postloopMethod · 0.95

Calls 2

mapFunction · 0.85
encodeMethod · 0.80

Tested by

no test coverage detected