Unquote a single etag:

    >>> unquote_etag('w/"bar"')
    ('bar', True)
    >>> unquote_etag('"bar"')
    ('bar', False)

    :param etag: the etag identifier to unquote.
    :return: a ``(etag, weak)`` tuple.
976911
def unquote_etag(etag):
    
    if not etag:
        return None, None
    etag = etag.strip()
    weak = False
    if etag[:2] in ('w/', 'W/'):
        weak = True
        etag = etag[2:]
    if etag[:1] == etag[-1:] == '"':
        etag = etag[1:-1]
    return etag, weak
672735
def unquote_redirection_tokens(args: List[str]) -> None:
    
    for i, arg in enumerate(args):
        unquoted_arg = strip_quotes(arg)
        if unquoted_arg in constants.REDIRECTION_TOKENS:
            args[i] = unquoted_arg
1116769
public static String removeQuotes(String arg) {
        if (arg == null) {
            return null;
        }
        int length = arg.length();
        if (length > 1 && arg.startsWith("\"") && arg.endsWith("\"")) {
            return arg.substring(1, length - 1);
        }
        return arg;
    }
511382
def _unquote_or_none(s: Optional[str]) -> Optional[bytes]:  # noqa: F811
    
    if s is None:
        return s
    return url_unescape(s, encoding=None, plus=False)
1026890
def unquoted(cls, value, literal=False):
        """"""
        return cls(value, quotes=None, literal=literal)
375105
def unquote_string(self, string):
        """"""
        value = string[1:-1]

        forbidden_sequences = {ESCAPE_SUBS[STRING_QUOTES[string[0]]]}
        valid_sequences = set(ESCAPE_SEQUENCES) - forbidden_sequences

        for seq in ESCAPE_REGEX.findall(value):
            if seq not in valid_sequences:
                raise self.error(f'Invalid escape sequence "{seq}"')

        for seq, sub in ESCAPE_SEQUENCES.items():
            value = value.replace(seq, sub)

        return value
1265331
def multipart_etag(digests):
    
    etag = hashlib.md5()
    count = 0
    for dig in digests:
        count += 1
        etag.update(binascii.a2b_hex(dig))
    return '"{}-{}"'.format(etag.hexdigest(), count)
1320209
def unquote_header_value(value):
    
    """
    if value and value[0] == value[-1] == '"':
        # this is not the real unquoting, but fixing this so that the
        # RFC is met will result in bugs with internet explorer and
        # probably some other browsers as well.  IE for example is
        # uploading files with "C:\foo\bar.txt" as filename
        value = value[1:-1].replace('\\\\', '\\').replace('\\"', '"')
    return value
453537
def contains_unquoted_target(x: str,
                             quote: str = '"', target: str = '&') -> bool:
    
    in_quote = False
    for c in x:
        if c == quote:
            in_quote = not in_quote
        elif c == target:
            if not in_quote:
                return True
    return False
130580
public final void mQUOTED_String() throws RecognitionException {
		try {
			int _type = QUOTED_String;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:782:4: ( '\\'' ( ( ESCqs )=> ESCqs |~ '\\'' )* '\\'' )
			// hql.g:782:6: '\\'' ( ( ESCqs )=> ESCqs |~ '\\'' )* '\\''
			{
			match('\''); if (state.failed) return;
			// hql.g:782:11: ( ( ESCqs )=> ESCqs |~ '\\'' )*
			loop3:
			while (true) {
				int alt3=3;
				int LA3_0 = input.LA(1);
				if ( (LA3_0=='\'') ) {
					int LA3_1 = input.LA(2);
					if ( (LA3_1=='\'') && (synpred1_hql())) {
						alt3=1;
					}

				}
				else if ( ((LA3_0 >= '\u0000' && LA3_0 <= '&')||(LA3_0 >= '(' && LA3_0 <= '\uFFFF')) ) {
					alt3=2;
				}

				switch (alt3) {
				case 1 :
					// hql.g:782:13: ( ESCqs )=> ESCqs
					{
					mESCqs(); if (state.failed) return;

					}
					break;
				case 2 :
					// hql.g:782:31: ~ '\\''
					{
					if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '&')||(input.LA(1) >= '(' && input.LA(1) <= '\uFFFF') ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

				default :
					break loop3;
				}
			}

			match('\''); if (state.failed) return;
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
1038344
def ensure_unicoded_and_unique(args_list, application):
    
    unicoded_args = []
    for argument in args_list:
        argument = (six.u(argument)
                    if not isinstance(argument, six.text_type) else argument)
        if argument not in unicoded_args or argument == application:
            unicoded_args.append(argument)
    return unicoded_args
1339018
public static String unquote(String s)
    {
        if (s==null)
            return null;
        if (s.length()<2)
            return s;

        char first=s.charAt(0);
        char last=s.charAt(s.length()-1);
        if (first!=last || (first!='"' && first!='\''))
            return s;
        
        StringBuffer b=new StringBuffer(s.length()-2);
        synchronized(b)
        {
            boolean quote=false;
            for (int i=1;i<s.length()-1;i++)
            {
                char c = s.charAt(i);

                if (c=='\\' && !quote)
                {
                    quote=true;
                    continue;
                }
                quote=false;
                b.append(c);
            }
            
            return b.toString();
        }
    }
461267
def unquote_string(code):
    """"""

    scode = code.strip()
    assert scode[-1] in ["'", '"']
    assert scode[0] in ["'", '"'] or scode[1] in ["'", '"']

    return ast.literal_eval(scode)
585141
def unquote(text):
    """"""
    while '%' in text:
        newtext = url_unquote(text)
        if newtext == text:
            break
        text = newtext
    return text
421629
def dequote(s):
        """"""
        if len(s) < 2:
            return s
        elif (s[0] == s[-1]) and s.startswith(('"', "'")):
            return s[1: -1]
        else:
            return s
1229783
def etag(self, etag):
        
        if not isinstance(etag, list):
            etag = [etag]
        for e in etag:
            option = Option()
            option.number = defines.OptionRegistry.ETAG.number
            if not  isinstance(e, bytes):
                e = bytes(e, "utf-8")
            option.value = e
            self.add_option(option)
231362
def clean_etag(self, etag):
        
        if etag:
            etag = etag.replace('"', '')
            extension = None
            for ext, mime in self.EXTENSION_MAP:
                if mime == self.type:
                    extension = ext[1:]
                    break
            if extension:
                etag += '_' + extension
            self.response.etag = etag