Extracts a string parameter from a CGI form, or ``None`` if the key doesn't
    exist or the string is zero-length.
762470
def get_cgi_parameter_str_or_none(form: cgi.FieldStorage,
                                  key: str) -> Optional[str]:
    
    s = get_cgi_parameter_str(form, key)
    if s is None or len(s) == 0:
        return None
    return s
767630
def getIntFromGet(request,key):
    '''
    
    '''
    try:
        return int(request.GET.get(key))
    except (ValueError, TypeError):
        return None
572062
def parse_addr(text):
    ""
    if text:
        parts = text.split(':')
        length = len(parts)
        if length== 3:
            return parts[0], parts[1], int(parts[2])
        elif length == 2:
            return None, parts[0], int(parts[1])
        elif length == 1:
            return None, '', int(parts[0])
    return None, None, None
484407
def convert_none(key, val, attr_type, attr={}, cdata=False):
    """"""
    LOG.info('Inside convert_none(): key="%s"' % (unicode_me(key)))

    key, attr = make_valid_xml_name(key, attr)

    if attr_type:
        attr['type'] = get_xml_type(val)
    attrstring = make_attrstring(attr)
    return '<%s%s></%s>' % (key, attrstring, key)
130524
def from_string(s):
        """"""

        if not len(s):
            raise ValueError("Invalid parameter string.")

        params = parse_qs(u(s), keep_blank_values=False)
        if not len(params):
            raise ValueError("Invalid parameter string.")

        try:
            key = params['oauth_token'][0]
        except Exception:
            raise ValueError("'oauth_token' not found in OAuth request.")

        try:
            secret = params['oauth_token_secret'][0]
        except Exception:
            raise ValueError("'oauth_token_secret' not found in " 
                "OAuth request.")

        token = Token(key, secret)
        try:
            token.callback_confirmed = params['oauth_callback_confirmed'][0]
        except KeyError:
            pass  # 1.0, no callback confirmed.
        return token
1181765
def getPlainText(self, iv, key, ciphertext):
        
        try:
            cipher = AESCipher(key, iv)
            plaintext = cipher.decrypt(ciphertext)
            if sys.version_info >= (3, 0):
                return plaintext.decode()
            return plaintext
        except Exception as e:
            raise InvalidMessageException(e)
112852
def get_cgi_parameter_int(form: cgi.FieldStorage, key: str) -> Optional[int]:
    
    return get_int_or_none(get_cgi_parameter_str(form, key))
1296118
def _ekey(self, key):
        '''  '''
        key = key.replace('-','_').upper()
        if key in self.cgikeys:
            return key
        return 'HTTP_' + key
451163
def _get_and_assert_slice_param(url_dict, param_name, default_int):
    
    param_str = url_dict['query'].get(param_name, default_int)
    try:
        n = int(param_str)
    except ValueError:
        raise d1_common.types.exceptions.InvalidRequest(
            0,
            'Slice parameter is not a valid integer. {}="{}"'.format(
                param_name, param_str
            ),
        )
    if n < 0:
        raise d1_common.types.exceptions.InvalidRequest(
            0,
            'Slice parameter cannot be a negative number. {}="{}"'.format(
                param_name, param_str
            ),
        )
    return n
932214
def get_cgi_parameter_datetime(form: cgi.FieldStorage,
                               key: str) -> Optional[datetime.datetime]:
    
    try:
        s = get_cgi_parameter_str(form, key)
        if not s:
            # if you dateutil.parser.parse() an empty string,
            # you get today's date
            return None
        d = dateutil.parser.parse(s)
        if d.tzinfo is None:  # as it will be
            d = d.replace(tzinfo=dateutil.tz.tzlocal())
        return d
    except ValueError:
        return None
197705
def parse_form_encoded(data)
      data.split(/[&;]/).map do |pair|
        key, value = pair.split('=', 2).map { |v| CGI::unescape(v) }
        [key, value] unless [nil, ''].include?(key)
      end.compact
    end
344662
private String getParameter(String paramKey, String defaultValue) {
        String paramValue = defaultValue;
        if (StringUtils.isNotBlank(paramKey) && args != null && args.length > 0) {
            for (String arg : args) {
                String[] parameter = arg.split("=");
                if (parameter != null && parameter.length == 2 && paramKey.equals(parameter[0])) {
                    paramValue = parameter[1];
                    break;
                }
            }
        }
        return paramValue;
    }
392019
def get_cgi_parameter_list(form: cgi.FieldStorage, key: str) -> List[str]:
    
    return form.getlist(key)
3351
def extract_key_value(line, environ):
    
    segments = line.split("=", 1)
    if len(segments) < 2:
        return None
    key, value = segments
    # foo passes through as-is (with spaces stripped)
    # '{foo}' passes through literally
    # "{foo}" substitutes from environ's foo
    value = value.strip()
    if value[0] == "'" and _SQUOTE_RE.match(value):
        value = value[1:-1]
    elif value[0] == '"' and _DQUOTE_RE.match(value):
        template = value[1:-1]
        value = template.format(**environ)
    key = key.strip()
    value = value.strip()
    return key, value
1368930
def _find_parameter(cls, dct):
        ''''''

        num_found = 0
        field = None

        for key, val in dct.iteritems():
            if isinstance(val, DataType) and val.is_key:
                field = key
                num_found += 1

        if num_found > 1:
            raise SetupError(502)
        elif num_found == 0:
            return False

        dct['_cbs_key_field'] = field
        dct['key'] = cls._build_prop(field)
        return True
264604
public Optional<String> getRawString(String key) {
    return get(definitions.validKey(requireNonNull(key)));
  }
30477
def get_raw_string(self, idx):
        
        try:
            off = self.__manage_item[TypeMapItem.STRING_ID_ITEM][idx].get_string_data_off()
        except IndexError:
            log.warning("unknown string item @ %d" % idx)
            return "AG:IS: invalid string"

        try:
            return self.__strings_off[off].get()
        except KeyError:
            log.warning("unknown string item @ 0x%x(%d)" % (off, idx))
            return "AG:IS: invalid string"