Return key, value from given line if present, else return None.
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
1285813
def getkey(mapping, value, default=None, use_id=False):
    '''
    '''
    if use_id:
        for key, val in mapping.items():
            if val is value:
                return key
    else:
        for key, val in mapping.items():
            if val == value:
                return key
    return default
510246
def get(self, key, default=None):
        
        try:
            return self.items[key]
        except IndexError:
            return value(default)
502699
def _get_property(self):
        """"""
        line = self.next_line()
        if line is None:
            return None
        elif line.startswith(b'property '):
            return self._name_value(line[len(b'property '):])
        else:
            self.push_line(line)
            return None
871363
def get_key(cls, key):
        ""
        return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None))
26384
def get(self, key):
        '''
        
        '''
        if key in self._data_fields:
            return self._data_fields[key]
        if key in self._sub_reports:
            return self._sub_reports[key]
        return None
1299217
def _find_value(key, *args):
    """'"""
    for arg in args:
        v = _get_value(arg, key)
        if v is not None:
            return v
805832
def get(self, key, namespace=None):
        """"""
        if not self.path:
            return NO_VALUE

        logger.debug('Searching %r for key: %s, namepsace: %s', self, key, namespace)
        full_key = generate_uppercase_key(key, namespace)
        return get_key_from_envs(self.cfg, full_key)
1222598
def pull(self, key, default=None):
        
        val = self.get(key, default)

        self.forget(key)

        return val
419680
def extract_key_value(line)
      match = line.match(KEY_VALUE_PATTERN)
      if match
        key = match[1]
        value = match[2]
        [key.strip, value.strip]
      else
        []
      end
    end
1225133
def get(self, key, defaultValue=None):
        """"""
        if defaultValue is None:   # Py4J doesn't call the right get() if we pass None
            if self._jconf is not None:
                if not self._jconf.contains(key):
                    return None
                return self._jconf.get(key)
            else:
                if key not in self._conf:
                    return None
                return self._conf[key]
        else:
            if self._jconf is not None:
                return self._jconf.get(key, defaultValue)
            else:
                return self._conf.get(key, defaultValue)
950583
def get(self, key, _else=None):
        
        with self._lock:
            self.expired()
            # see if everything expired
            try:
                value = self._dict[key].get()
                return value
            except KeyError:
                return _else
            except ValueError:
                return _else
317860
def get_value(self, series, key):
        """"""
        if np.asarray(key).dtype == np.dtype(bool):
            return series.iloc[key]
        elif isinstance(key, slice):
            return series.iloc[self.slice_indexer(
                key.start, key.stop, key.step)]
        else:
            return series.iloc[self.get_loc(key)]
762605
def _get_dict(lines, start_index, indentation, deep):
    """"""

    info = {}
    current_item = None

    i = start_index
    while i < len(lines):

        current_line = lines[i]
        current_line_indentation = _get_indentation(current_line)

        # Check for multi-level returns
        if current_line_indentation < indentation:
            return info, i-1

        if current_line_indentation == indentation:
            current_item = current_line.lstrip(' ')
            info[current_item] = {}
            i = i + 1
            continue

        if i < len(lines) - 1:
            next_line_indentation = _get_indentation(lines[i+1])
        else:
            next_line_indentation = current_line_indentation

        if next_line_indentation > current_line_indentation:
            ret_dict, i = _get_dict(lines, i, current_line_indentation, deep+1)
            for key in ret_dict.keys():
                if key in info[current_item]:
                    info[current_item][key].update(ret_dict[key])
                else:
                    info[current_item][key] = ret_dict[key]
        else:
            key, value = _get_key_value(current_line)
            if key:
                info[current_item][key] = value

        # Do not return if it's the top level of recursion
        if next_line_indentation < current_line_indentation and deep > 0:
            return info, i

        i = i + 1

    return info, i
222127
def find_in_line(line):  # type: (str)->Tuple[Optional[str],Optional[str]]
    
    if not line:
        return None, None
    for version_token in version_tokens:

        by_ast = find_by_ast(line, version_token)
        by_ast = validate_string(by_ast)
        if by_ast:
            return by_ast, version_token

        by_string_lib = find_version_by_string_lib(line, version_token)
        by_string_lib = validate_string(by_string_lib)
        if by_string_lib:
            return by_string_lib, version_token

        by_regex = find_version_by_regex(line, version_token)
        by_regex = validate_string(by_regex)
        if by_regex:
            return by_regex, version_token
    return None, None
1341973
def dict_find_key(dd, value):
    
    key = next(key for key, val in dd.items() if val == value)
    return key
229024
def get(self, key, default=None):
        
        try:
            val = self[key]
        except KeyError:
            val = default
        return val