(self, option)
| 956 | # -- Option-adding methods ----------------------------------------- |
| 957 | |
| 958 | def _check_conflict(self, option): |
| 959 | conflict_opts = [] |
| 960 | for opt in option._short_opts: |
| 961 | if opt in self._short_opt: |
| 962 | conflict_opts.append((opt, self._short_opt[opt])) |
| 963 | for opt in option._long_opts: |
| 964 | if opt in self._long_opt: |
| 965 | conflict_opts.append((opt, self._long_opt[opt])) |
| 966 | |
| 967 | if conflict_opts: |
| 968 | handler = self.conflict_handler |
| 969 | if handler == "error": |
| 970 | raise OptionConflictError( |
| 971 | "conflicting option string(s): %s" |
| 972 | % ", ".join([co[0] for co in conflict_opts]), |
| 973 | option) |
| 974 | elif handler == "resolve": |
| 975 | for (opt, c_option) in conflict_opts: |
| 976 | if opt.startswith("--"): |
| 977 | c_option._long_opts.remove(opt) |
| 978 | del self._long_opt[opt] |
| 979 | else: |
| 980 | c_option._short_opts.remove(opt) |
| 981 | del self._short_opt[opt] |
| 982 | if not (c_option._short_opts or c_option._long_opts): |
| 983 | c_option.container.option_list.remove(c_option) |
| 984 | |
| 985 | def add_option(self, *args, **kwargs): |
| 986 | """add_option(Option) |
no test coverage detected