<commit_before>import itertools
import re
from shlex import shlex
from six import iteritems, string_types

from .. import iterutils
from .list import shell_list
from ..platforms.host import platform_info
from ..safe_str import jbos, safe_str, shell_literal

__all__ = ['split', 'join', 'listify', 'inner_quote', 'inner_quote_info',
           'wrap_quotes', 'quote', 'quote_info', 'escape_line', 'join_lines',
           'local_env', 'global_env']

_bad_chars = re.compile(r'[^\w@%+:,./-]')
_ends_unescaped_quote = re.compile(r"(^|[^\\])(\\\\)*'$")


def split(s, type=list, escapes=False):
    if not isinstance(s, string_types):
        raise TypeError('expected a string')
    lexer = shlex(s, posix=True)
    lexer.commenters = ''
    if not escapes:
        lexer.escape = ''
    lexer.whitespace_split = True
    return type(lexer)


def join(args):
    return ' '.join(quote(i) for i in args)


def listify(thing, type=list):
    if isinstance(thing, string_types):
        return split(thing, type)
    return iterutils.listify(thing, type=type)


def inner_quote_info(s):<commit_msg>Don't bother quoting strings in POSIX shells when there's an '='<commit_after>import itertools
import re
from shlex import shlex
from six import iteritems, string_types

from .. import iterutils
from .list import shell_list
from ..platforms.host import platform_info
from ..safe_str import jbos, safe_str, shell_literal

__all__ = ['split', 'join', 'listify', 'inner_quote', 'inner_quote_info',
           'wrap_quotes', 'quote', 'quote_info', 'escape_line', 'join_lines',
           'local_env', 'global_env']

_bad_chars = re.compile(r'[^\w@%+=:,./-]')
_ends_unescaped_quote = re.compile(r"(^|[^\\])(\\\\)*'$")


def split(s, type=list, escapes=False):
    if not isinstance(s, string_types):
        raise TypeError('expected a string')
    lexer = shlex(s, posix=True)
    lexer.commenters = ''
    if not escapes:
        lexer.escape = ''
    lexer.whitespace_split = True
    return type(lexer)


def join(args):
    return ' '.join(quote(i) for i in args)


def listify(thing, type=list):
    if isinstance(thing, string_types):
        return split(thing, type)
    return iterutils.listify(thing, type=type)


def inner_quote_info(s):
{'fraction_non_alphanumeric': 0.14311270125223613, 'fraction_numerical': 0.0, 'mean_word_length': 3.938189845474614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3672660', 'n_tokens_mistral': 782, 'n_tokens_neox': 748, 'n_words': 195}