MCPcopy Create free account
hub / github.com/WavesMan/Disable-automatic-Windows-update / _cmp

Method _cmp

python/core/services.py:251–268  ·  view source on GitHub ↗
(self, a: str, b: str)

Source from the content-addressed store, hash-verified

249 return [int(n) for n in nums] if nums else []
250
251 def _cmp(self, a: str, b: str) -> int:
252 na = self._parse_nums(a)
253 nb = self._parse_nums(b)
254 if na and nb:
255 L = max(len(na), len(nb))
256 for i in range(L):
257 va = na[i] if i < len(na) else 0
258 vb = nb[i] if i < len(nb) else 0
259 if va < vb:
260 return -1
261 if va > vb:
262 return 1
263 return 0
264 if not na and nb:
265 return -1
266 if na and not nb:
267 return 1
268 return 0
269
270 def check_update(self, current_version: str | None = None) -> Result:
271 cur = current_version or self.CURRENT_VERSION

Callers 1

check_updateMethod · 0.95

Calls 1

_parse_numsMethod · 0.95

Tested by

no test coverage detected