def parse(self, name, description):
        """
        Parse option name.

        :param name: option's name
        :param description: option's description

        Parsing acceptable names:

            * -f: shortname
            * --force: longname
            * -f, --force: shortname and longname
            * -o <output>: shortname and a required value
            * -o, --output [output]: shortname, longname and optional value

        Parsing default value from description:

            * source directory, default: src
            * source directory, default: [src]
            * source directory, default: <src>
        """

        name = name.strip()

        if '<' in name:
            self.required = True
            self.boolean = False
            name = name[:name.index('<')].strip()
        elif name in '[':
            self.required = False
            self.boolean = False
            name = name[:name.index('[')].strip()
        else:
            self.required = False
            self.boolean = True

        regex = re.compile(r'(-\w)?(?:\,\s*)?(--[\w\-]+)?')

        m = regex.findall(name)
        if not m:
            raise ValueError('Invalid Option: %s', name)

        shortname, longname = m[0]

        if not shortname and not longname:
            raise ValueError('Invalid Option: %s', name)

        self.shortname = shortname
        self.longname = longname

        # parse store key
        if longname and longname.startswith('--no-'):
            self.key = longname[5:]
        elif longname:
            self.key = longname[2:]
        else:
            self.key = shortname

        if self.boolean:
            # boolean don't need to parse from description
            if longname and longname.startswith('--no-'):
                self.default = True
            else:
                self.default = False
            return self

        if not description:
            self.default = None
            return self

        # parse default value from description
        regex = re.compile(r'\sdefault:(.*)$')
        m = regex.findall(description)
        if not m:
            self.default = None
            return self

        # if it has a default value, it is not required
        self.required = False

        value = m[0].strip()
        if value.startswith('<') and value.endswith('>'):
            value = value[1:-1]
        elif value.startswith('[') and value.endswith(']'):
            value = value[1:-1]

        self.default = value.strip()
        return self
dataset/ETHPy150Open lepture/terminal/terminal/command.py/Option.parse/swapped operands of `in`