MCPcopy Index your code
hub / github.com/WebODM/WebODM / versionToInt

Function versionToInt

app/plugins/functions.py:361–378  ·  view source on GitHub ↗

Converts a WebODM version string (major.minor.build) to a integer value for comparison >>> versionToInt("1.2.3") 100203 >>> versionToInt("1") 100000 >>> versionToInt("1.2.3.4") 100203 >>> versionToInt("wrong") -1

(version)

Source from the content-addressed store, hash-verified

359 return Setting.objects.first()
360
361def versionToInt(version):
362 """
363 Converts a WebODM version string (major.minor.build) to a integer value
364 for comparison
365 >>> versionToInt("1.2.3")
366 100203
367 >>> versionToInt("1")
368 100000
369 >>> versionToInt("1.2.3.4")
370 100203
371 >>> versionToInt("wrong")
372 -1
373 """
374
375 try:
376 return sum([reduce(lambda mult, ver: mult * ver, i) for i in zip([100000, 100, 1], map(int, version.split(".")))])
377 except:
378 return -1

Callers 1

get_pluginsFunction · 0.85

Calls 1

mapFunction · 0.50

Tested by

no test coverage detected