MCPcopy Create free account
hub / github.com/numpy/numpy / get_option_single

Method get_option_single

numpy/distutils/system_info.py:793–822  ·  view source on GitHub ↗

Ensure that only one of `options` are found in the section Parameters ---------- *options : list of str a list of options to be found in the section (``self.section``) Returns ------- str : the option that is uniquely found in

(self, *options)

Source from the content-addressed store, hash-verified

791 self.saved_results[self.__class__.__name__] = info
792
793 def get_option_single(self, *options):
794 """ Ensure that only one of `options` are found in the section
795
796 Parameters
797 ----------
798 *options : list of str
799 a list of options to be found in the section (``self.section``)
800
801 Returns
802 -------
803 str :
804 the option that is uniquely found in the section
805
806 Raises
807 ------
808 AliasedOptionError :
809 in case more than one of the options are found
810 """
811 found = [self.cp.has_option(self.section, opt) for opt in options]
812 if sum(found) == 1:
813 return options[found.index(True)]
814 elif sum(found) == 0:
815 # nothing is found anyways
816 return options[0]
817
818 # Else we have more than 1 key found
819 if AliasedOptionError.__doc__ is None:
820 raise AliasedOptionError()
821 raise AliasedOptionError(AliasedOptionError.__doc__.format(
822 section=self.section, options='[{}]'.format(', '.join(options))))
823
824
825 def has_info(self):

Callers 12

calc_ver_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
_calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80
calc_infoMethod · 0.80

Calls 4

AliasedOptionErrorClass · 0.85
sumFunction · 0.50
indexMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected