mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
Use feature detection instead of version detection
Python porting best practice is to Use feature detection instead of version detection * https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection
This commit is contained in:
parent
e5376b9c93
commit
ca658ed745
1 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,6 @@ import collections
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import psutil
|
import psutil
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
class Attribute(BaseObject):
|
class Attribute(BaseObject):
|
||||||
|
@ -121,9 +120,10 @@ class IntParam(Param):
|
||||||
|
|
||||||
def validateValue(self, value):
|
def validateValue(self, value):
|
||||||
# handle unsigned int values that are translated to int by shiboken and may overflow
|
# handle unsigned int values that are translated to int by shiboken and may overflow
|
||||||
longInt = int if sys.version_info > (3,) else long
|
|
||||||
try:
|
try:
|
||||||
return longInt(value)
|
return long(value) # Python 2
|
||||||
|
except NameError:
|
||||||
|
return int(value) # Python 3
|
||||||
except:
|
except:
|
||||||
raise ValueError('IntParam only supports int value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
raise ValueError('IntParam only supports int value (param:{}, value:{}, type:{})'.format(self.name, value, type(value)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue