Exemple #1
0
 def set_p_str(self):
     import os, time  # needed in locals for prompt string handling
     loc = locals()
     self.p_str = ItplNS(
         '%s%s%s' % ('${self.col_p2}',
                     multiple_replace(prompt_specials,
                                      self.p_template), '$self.col_norm'),
         self.cache.user_ns, loc)
     self.p_str_nocolor = ItplNS(
         multiple_replace(prompt_specials_nocolor, self.p_template),
         self.cache.user_ns, loc)
Exemple #2
0
    def set_p_str(self):
        """ Set the interpolating prompt strings.

        This must be called every time the color settings change, because the
        prompt_specials global may have changed."""

        import os, time  # needed in locals for prompt string handling
        loc = locals()
        self.p_str = ItplNS(
            '%s%s%s' % ('${self.sep}${self.col_p}',
                        multiple_replace(prompt_specials,
                                         self.p_template), '${self.col_norm}'),
            self.cache.user_ns, loc)

        self.p_str_nocolor = ItplNS(
            multiple_replace(prompt_specials_nocolor, self.p_template),
            self.cache.user_ns, loc)
Exemple #3
0
    def var_expand(self, template):
        """ Expand $variables in the current namespace using Itpl.

        Parameters
        ----------
        template : str
        """

        return str(ItplNS(template, self.namespace))