mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-02 08:18:25 +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 os
|
||||
import psutil
|
||||
import sys
|
||||
|
||||
|
||||
class Attribute(BaseObject):
|
||||
|
@ -121,9 +120,10 @@ class IntParam(Param):
|
|||
|
||||
def validateValue(self, value):
|
||||
# handle unsigned int values that are translated to int by shiboken and may overflow
|
||||
longInt = int if sys.version_info > (3,) else long
|
||||
try:
|
||||
return longInt(value)
|
||||
return long(value) # Python 2
|
||||
except NameError:
|
||||
return int(value) # Python 3
|
||||
except:
|
||||
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