MCPcopy Index your code
hub / github.com/numpy/numpy / upgrade

Method upgrade

numpy/lib/_iotools.py:726–752  ·  view source on GitHub ↗

Find the best converter for a given string, and return the result. The supplied string `value` is converted by testing different converters in order. First the `func` method of the `StringConverter` instance is tried, if this fails other available converters

(self, value)

Source from the content-addressed store, hash-verified

724 self.default = default
725
726 def upgrade(self, value):
727 """
728 Find the best converter for a given string, and return the result.
729
730 The supplied string `value` is converted by testing different
731 converters in order. First the `func` method of the
732 `StringConverter` instance is tried, if this fails other available
733 converters are tried. The order in which these other converters
734 are tried is determined by the `_status` attribute of the instance.
735
736 Parameters
737 ----------
738 value : str
739 The string to convert.
740
741 Returns
742 -------
743 out : any
744 The result of converting `value` with the appropriate converter.
745
746 """
747 self._checked = True
748 try:
749 return self._strict_call(value)
750 except ValueError:
751 self._do_upgrade()
752 return self.upgrade(value)
753
754 def iterupgrade(self, value):
755 self._checked = True

Callers 4

test_upgradeMethod · 0.95
test_missingMethod · 0.95
test_keep_defaultMethod · 0.95
genfromtxtFunction · 0.80

Calls 2

_strict_callMethod · 0.95
_do_upgradeMethod · 0.95

Tested by 3

test_upgradeMethod · 0.76
test_missingMethod · 0.76
test_keep_defaultMethod · 0.76