Return a tabbed string from an expanded one.
544413
def re_tab(s):
    """"""
    l = []
    p = 0
    for i in range(8, len(s), 8):
        if s[i - 2:i] == "  ":
            # collapse two or more spaces into a tab
            l.append(s[p:i].rstrip() + "\t")
            p = i

    if p == 0:
        return s
    else:
        l.append(s[p:])
        return "".join(l)
333316
def expand(cls, match, expand):
        
        return re._expand(match.re, cls._EncodedMatch(match), expand)
603834
def _to_string(self):
        """"""
        if self.sections:
            start = "/" if self.bound_start else "**/"
            sections = "/**/".join(str(section) for section in self.sections)
            end = "" if self.bound_end else "/**"
        else:
            start = ""
            sections = ""
            end = "" if self.bound_end else "**"
        return "{0}{1}{2}/{3}".format(start, sections, end, str(self.file_pattern))
428546
def to_string(self, verbose=0):
        """"""
        rows = [[it + 1] + list(map(str, (self[k][it] for k in self.keys())))
                for it in range(self.num_iterations)]

        return tabulate(rows, headers=["Iter"] + list(self.keys()))
171235
def restore_expanded_state(self):
        """"""
        if self.__expanded_state is None:
            return
        for item in self.get_items()+self.get_top_level_items():
            user_text = get_item_user_text(item)
            is_expanded = self.__expanded_state.get(hash(user_text))
            if is_expanded is not None:
                item.setExpanded(is_expanded)
414888
def _get_tab_description(self):
        """"""
        text = self._get_page().text_tab
        if "(" in text:
            text = text[:text.index("(") - 1]
        text = text[0].lower() + text[1:]
        return text
1247117
private char getNextExpanded()
        throws XMLStreamException
    {
        while (true) {
            char c = (mInputPtr < mInputEnd) ?
                mInputBuffer[mInputPtr++] : getNextChar(getErrorMsg());
            if (c != '%') {
                return c;
            }
            expandPE();
        }
    }
1062944
def fromstring(cls, ptb_string, namespace='ptb', precedence=False,
                  ignore_traces=True):
        """"""
        temp = tempfile.NamedTemporaryFile(delete=False)
        temp.write(ptb_string)
        temp.close()
        ptb_docgraph = cls(ptb_filepath=temp.name, namespace=namespace,
                           precedence=precedence, ignore_traces=ignore_traces)
        os.unlink(temp.name)
        return ptb_docgraph
1176246
def from_string(self, value):
        """"""
        if not isinstance(value, basestring):
            raise ValueError('expected string value: ' + str(type(value)))
        self.test_value(value)
        return value
992940
def fsliceafter(astr, sub):
    """"""
    findex = astr.find(sub)
    return astr[findex + len(sub):]
1005293
def FromString(s, **kwargs):
    """"""
    
    f = StringIO.StringIO(s)
    return FromFile(f, **kwargs)
1253946
def get_expanded_path(path):
    """"""
    if path:
        result = path
        result = os.path.expanduser(result)
        result = os.path.expandvars(result)
        return result
    else:
        return None
164393
def get_string_at_rva(self, rva):
        """"""

        s = self.get_section_by_rva(rva)
        if not s:
            return self.get_string_from_data(0, self.__data__[rva:rva+MAX_STRING_LENGTH])
        
        return self.get_string_from_data( 0, s.get_data(rva, length=MAX_STRING_LENGTH) )
566088
function getExpandoData(ownerDocument) {
    var data = expandoData[ownerDocument[expando]];
    if (!data) {
        data = {};
        expanID++;
        ownerDocument[expando] = expanID;
        expandoData[expanID] = data;
    }
    return data;
  }
176283
def copy_with_new_str(self, new_str):
        """"""
        # What to do when there are multiple Chunks with conflicting atts?
        old_atts = dict((att, value) for bfs in self.chunks
                    for (att, value) in bfs.atts.items())
        return FmtStr(Chunk(new_str, old_atts))
968759
def get_string_from_data(self, offset, data):
        """"""
        s = self.get_bytes_from_data(offset, data)
        end = s.find(b'\0')
        if end >= 0:
            s = s[:end]
        return s
243299
def _str(self, indent=""):
        """"""
        if self.ndim <= 1:
            return "[" + ", ".join(str(x) for x in self) + "]"
        elif self.ndim == 2:
            sep = ",\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"
        else:
            sep = ",\n\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"