Try three parsing strategies, favoring semver, then pep440, then whatev.
    :param string:
    :return:
541269
def version_object_and_next(string, retries=0):  # type: (str, int) -> VersionThing
    
    if retries > 2:
        raise JiggleVersionException(
            "Can't parse, ran out of retries: " + unicode(string)
        )
    if string == "" or string is None:
        raise JiggleVersionException("No version string, can only use default logic.")

    if string[0] == "v":
        string = string[1:]

    try:
        version = semantic_version.Version(string)
        next_version = version.next_patch()
        _ = semantic_version.Version(unicode(string))
        return version, next_version, "semantic_version"
    except:
        logger.debug("Not sem_ver:" + unicode(string))
        try:
            version = parver.Version.parse(string)
            next_version = version.bump_dev()
            _ = parver.Version.parse(unicode(next_version))
            return version, next_version, "pep440 (parver)"
        except:
            try:
                logger.debug("Not par_ver:" + unicode(string))
                # Version.supported_version_schemes = [Pep440VersionScheme, Simple4VersionScheme]
                version = versio_version.Version(string, scheme=Simple4VersionScheme)
                version.bump()
                return (
                    versio_version.Version(string, scheme=Simple4VersionScheme),
                    version,
                    "simple-4 part (versio)",
                )
            except:
                # let above libs try first before we do primitive clean up work
                retries += 1
                if "a" in string:
                    return version_object_and_next(string.replace("a", ".a"), retries)
                elif "b" in string:
                    return version_object_and_next(string.replace("b", ".b"), retries)
                elif len(string.split(".")) == 1:
                    # convert 2 part to 3 part.
                    return version_object_and_next(string + ".0.0", retries)
                elif len(string.split(".")) == 2:
                    # convert 2 part to 3 part, e.g. 1.1 -> 1.1.0
                    return version_object_and_next(string + ".0", retries)
                elif string.isnumeric() and "." not in string:
                    # e.g. "21" -> "21.0.0"
                    return version_object_and_next(string + ".0.0", retries)
                else:
                    logger.debug("Not versio:" + unicode(string))
                    # versio only does pep440 by default
                    # print(versio.version.Version.supported_version_schemes)
                    raise
708346
def _parse_package(cls, package_string):
        
        pkg, arch = rsplit(package_string, cls._arch_sep(package_string))
        if arch not in KNOWN_ARCHITECTURES:
            pkg, arch = (package_string, None)
        pkg, release = rsplit(pkg, '-')
        name, version = rsplit(pkg, '-')
        epoch, version = version.split(':', 1) if ":" in version else ['0', version]
        # oracleasm packages have a dash in their version string, fix that
        if name.startswith('oracleasm') and name.endswith('.el5'):
            name, version2 = name.split('-', 1)
            version = version2 + '-' + version
        return {
            'name': name,
            'version': version,
            'release': release,
            'arch': arch,
            'epoch': epoch
        }
1046860
def parse(self, elt, ps):
        '''
        '''
        self.checkname(elt, ps)
        if len(_children(elt)) == 0:
            href = _find_href(elt)
            if not href:
                if self.nilled(elt, ps) is False:
                    return []
                if self.nillable is True: 
                    return Nilled
                raise EvaluateException('Required string missing',
                        ps.Backtrace(elt))
            if href[0] != '#':
                return ps.ResolveHREF(href, self)
            elt = ps.FindLocalHREF(href, elt)
            self.checktype(elt, ps)

        if self.nilled(elt, ps): return Nilled
        if len(_children(elt)) == 0: return []

        v = self.simple_value(elt, ps)
        return self.text_to_data(v, elt, ps)
290782
def parse(self, string, evaluate_result=True):
        '''
        '''
        m = self._match_re.match(string)
        if m is None:
            return None

        if evaluate_result:
            return self.evaluate_result(m)
        else:
            return Match(self, m)
6943
function parse (string) {
  if (!string || typeof string !== 'string') {
    throw new TypeError('argument string is required')
  }

  var match = DISPOSITION_TYPE_REGEXP.exec(string)

  if (!match) {
    throw new TypeError('invalid type format')
  }

  // normalize type
  var index = match[0].length
  var type = match[1].toLowerCase()

  var key
  var names = []
  var params = {}
  var value

  // calculate index to start at
  index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';'
    ? index - 1
    : index

  // match parameters
  while ((match = PARAM_REGEXP.exec(string))) {
    if (match.index !== index) {
      throw new TypeError('invalid parameter format')
    }

    index += match[0].length
    key = match[1].toLowerCase()
    value = match[2]

    if (names.indexOf(key) !== -1) {
      throw new TypeError('invalid duplicate parameter')
    }

    names.push(key)

    if (key.indexOf('*') + 1 === key.length) {
      // decode extended value
      key = key.slice(0, -1)
      value = decodefield(value)

      // overwrite existing value
      params[key] = value
      continue
    }

    if (typeof params[key] === 'string') {
      continue
    }

    if (value[0] === '"') {
      // remove quotes and escapes
      value = value
        .substr(1, value.length - 2)
        .replace(QESC_REGEXP, '$1')
    }

    params[key] = value
  }

  if (index !== -1 && index !== string.length) {
    throw new TypeError('invalid parameter format')
  }

  return new ContentDisposition(type, params)
}
1128334
def parse_next(self, ptype, m):
        
        if self.transport.server_mode and (ptype == MSG_KEXGSS_INIT):
            return self._parse_kexgss_init(m)
        elif not self.transport.server_mode and (ptype == MSG_KEXGSS_HOSTKEY):
            return self._parse_kexgss_hostkey(m)
        elif self.transport.server_mode and (ptype == MSG_KEXGSS_CONTINUE):
            return self._parse_kexgss_continue(m)
        elif not self.transport.server_mode and (ptype == MSG_KEXGSS_COMPLETE):
            return self._parse_kexgss_complete(m)
        elif ptype == MSG_KEXGSS_ERROR:
            return self._parse_kexgss_error(m)
        msg = "GSS KexGroup1 asked to handle packet type {:d}"
        raise SSHException(msg.format(ptype))
170450
def parse_version_string(version_string):
    """"""
    string_parts =  version_string.split(".")
    version_parts = [
        int(re.match("([0-9]*)", string_parts[0]).group(0)),
        int(re.match("([0-9]*)", string_parts[1]).group(0)),
        int(re.match("([0-9]*)", string_parts[2]).group(0))
    ]
    return version_parts
928357
def parse_string(self, string):  # type: (str) -> Dict[str, Any]
        
        lines = string.split('\n')

        reader = vimlparser.StringReader(lines)
        parser = vimlparser.VimLParser(self._enable_neovim)
        ast = parser.parse(reader)

        # TOPLEVEL does not have a pos, but we need pos for all nodes
        ast['pos'] = {'col': 1, 'i': 0, 'lnum': 1}

        for plugin in self.plugins:
            plugin.process(ast)

        return ast
1028391
def version_parser(version_string):
    
    version, commit, branch = version_string.split('-', 3)

    # Remove the "v"
    version_number = version[1:]
    version_number = int(version_number)

    return Version(version_number, commit, branch)
510811
function gettext($string)
    {
        global $PPHP;
        $req = grab('request');

        $default = $PPHP['config']['global']['default_lang'];
        $current = $req['lang'];

        $res = $string;
        try {
            if (self::$_gettext !== null) {
                $res = self::$_gettext->gettext($string);
            };
        } catch (\Exception $e) {
            echo $e->getMessage();
        };
        return $res;
    }
1251458
def parse!
      begin
        parse
      rescue StandardError => e
        raise e if @options[:trace] || e.is_a?(SystemExit)
        $stderr.puts "#{e.class}: " + e.message.to_s
        exit 1
      end
      exit 0
    end
1066833
def parseString(string):
    
    buildable_dependencies = []
    given_dependencies = []
    output_directory = None
    output_format = None
    building_directory = None
    output_name = None

    _check_whitespace(string)

    there_are_dependencies = _check_dependencies(string)
    if there_are_dependencies:
        buildable_dependencies, \
            given_dependencies, \
            string = _parse_dependencies(string)

    there_are_options = _check_building_options(string)
    if there_are_options:
        output_directory, \
            output_format, \
            building_directory, string = _parse_building_options(string)

    if string[0] == '>':
        string = string[1:]
    if string[-1] == '>':
        string = string[:-1]

    is_a_flow_operator = _check_flow_operator(string)
    if is_a_flow_operator:
        greater_than_location = string.index('>')
        output_name = string[greater_than_location + 1:]
        string = string[:greater_than_location]

    ret = object()
    ret.input_name = string
    ret.output_name = output_name
    ret.buildable_dependencies = buildable_dependencies
    ret.given_dependencies = given_dependencies
    ret.output_format = output_format
    ret.building_directory = building_directory
    ret.output_directory = output_directory
    return ret
1249585
def __parse(self, string=''):
        '''
        
        '''
        self.string = string
        self.string = self.wiki_re.sub('', self.string)
        # search for lists
        self.listmatch = re.search('^(\*+)', self.string)
        if self.listmatch:
            self.string = self.__list(self.listmatch) + re.sub('^(\*+)', \
                          '', self.string)
        return self.string
426735
public static function parse($string)
    {
        // Type X.Y.Z, can be parsed as Versionable
        if (substr_count($string, '.') === 2) {
            return VersionableParser::parse($string, 'Naneau\SemVer\Version\PreRelease');
        }

        $preRelease = new PreReleaseVersion;

        $parts = explode('.', $string);

        // Sanity check
        if (count($parts) === 0) {
            return $preRelease;
        }

        // Set the greek name
        $preRelease->setGreek(
            $parts[0]
        );

        // If there's another part it's a release number
        if (isset($parts[1])) {
            $preRelease->setReleaseNumber(
                (int) $parts[1]
            );
        }

        return $preRelease;
    }
510974
def parse_version_string(version_string):
    
    components = version_string.split('-') + [None, None]
    version = list(map(int, components[0].split('.')))
    build_tag = components[1] if components[1] else BUILD_TAG
    build_number = int(components[2]) if components[2] else components[2]

    return (version, build_tag, build_number)
442557
def _parse_java_version(line: str) -> tuple:
    
    m = VERSION_RE.search(line)
    version_str = m and m.group(0).replace('"', '') or '0.0.0'
    if '_' in version_str:
        fst, snd = version_str.split('_', maxsplit=2)
        version = parse_version(fst)
        return (version[1], version[2], int(snd))
    else:
        return parse_version(version_str)
226750
def message_from_string(s, *args, **kws):
    
    from future.backports.email.parser import Parser
    return Parser(*args, **kws).parsestr(s)