Re-enable python2 support...

pull/111/head
Raphaël Vinot 2017-07-22 22:22:39 +02:00
parent 78488db7aa
commit 0c66d80dd1
1 changed files with 9 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import json
import uuid import uuid
import abc import abc
import sys import sys
import six
class MISPObjectException(Exception): class MISPObjectException(Exception):
@ -18,7 +19,14 @@ class InvalidMISPObject(MISPObjectException):
pass pass
class MISPObjectGenerator(metaclass=abc.ABCMeta): if six.PY2:
import warnings
warnings.warn("You're using python 2, it is strongly recommended to use python >=3.4")
@six.add_metaclass(abc.ABCMeta) # Remove that line when discarding python2 support.
# Python3 way: class MISPObjectGenerator(metaclass=abc.ABCMeta):
class MISPObjectGenerator():
def __init__(self, template_dir): def __init__(self, template_dir):
"""This class is used to fill a new MISP object with the default values defined in the object template """This class is used to fill a new MISP object with the default values defined in the object template