Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
This method will attempt to call another method of this
call named "add_ + tag".
For example, if the tag is "image", this method will attempt to
call Token.add_image(). An exception is raised if the method is not
available.
:param child:
:param tag:
:return:
"""
try:
func = getattr(self, 'add_' + tag)
except AttributeError:
raise UnsupportedFeature(self.__class__.__name__, tag)
func(child)
def get_loader(path):
name, ext = os.path.splitext(path.lower())
try:
func = globals()['load_' + ext[1:]]
return func(path)
except KeyError:
raise UnsupportedFeature(ext)
self.firstgid = int(content.get('firstgid'))
# we need to mangle the path - tiled stores relative paths
dirname = os.path.dirname(self.parent.filename)
path = os.path.abspath(os.path.join(dirname, source))
try:
content = ElementTree.parse(path).getroot()
except IOError:
msg = 'Cannot load external tileset: {0}'
logger.error(msg.format(path))
raise Exception
else:
msg = 'Found external tileset, but cannot handle type: {0}'
logger.error(msg.format(self.source))
raise UnsupportedFeature(self.source)
def add_group(self, item):
raise UnsupportedFeature
def get_processor(feature):
try:
return globals()[feature + 'Token']()
except KeyError:
raise UnsupportedFeature(feature)