MCPcopy
hub / github.com/pallets/click / __init__

Method __init__

src/click/parser.py:128–163  ·  view source on GitHub ↗
(
        self,
        obj: CoreOption,
        opts: cabc.Sequence[str],
        dest: str | None,
        action: str | None = None,
        nargs: int = 1,
        const: t.Any | None = None,
    )

Source from the content-addressed store, hash-verified

126
127class _Option:
128 def __init__(
129 self,
130 obj: CoreOption,
131 opts: cabc.Sequence[str],
132 dest: str | None,
133 action: str | None = None,
134 nargs: int = 1,
135 const: t.Any | None = None,
136 ):
137 self._short_opts = []
138 self._long_opts = []
139 self.prefixes: set[str] = set()
140
141 for opt in opts:
142 prefix, value = _split_opt(opt)
143 if not prefix:
144 raise ValueError(
145 _("Invalid start character for option ({option})").format(
146 option=opt
147 )
148 )
149 self.prefixes.add(prefix[0])
150 if len(prefix) == 1 and len(value) == 1:
151 self._short_opts.append(opt)
152 else:
153 self._long_opts.append(opt)
154 self.prefixes.add(prefix)
155
156 if action is None:
157 action = "store"
158
159 self.dest = dest
160 self.action = action
161 self.nargs = nargs
162 self.const = const
163 self.obj = obj
164
165 @property
166 def takes_value(self) -> bool:

Callers

nothing calls this directly

Calls 1

_split_optFunction · 0.85

Tested by

no test coverage detected