Skip to content

Commit

Permalink
Merge 11f6182 into 7567c2e
Browse files Browse the repository at this point in the history
  • Loading branch information
withoutwaxaryan committed Jun 8, 2020
2 parents 7567c2e + 11f6182 commit e56b200
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
10 changes: 6 additions & 4 deletions fastkml/geometry.py
Expand Up @@ -132,10 +132,12 @@ def __init__(
def _set_altitude_mode(self, element):
if self.altitude_mode:
# XXX add 'relativeToSeaFloor', 'clampToSeaFloor',
assert(self.altitude_mode in [
'clampToGround',
'relativeToGround', 'absolute'
])
if self.altitude_mode not in ['clampToGround', 'relativeToGround',
'absolute']:
raise AssertionError("Altitude mode not in "
" not in clampToGround,"
"'relativeToGround' or"
"'absolute' mode")
if self.altitude_mode != 'clampToGround':
am_element = etree.SubElement(
element, "%saltitudeMode" % self.ns
Expand Down
16 changes: 11 additions & 5 deletions fastkml/kml.py
Expand Up @@ -408,7 +408,9 @@ def snippet(self):
if isinstance(self._snippet, dict):
text = self._snippet.get('text')
if text:
assert (isinstance(text, basestring))
if not (isinstance(text, basestring)):
raise TypeError("text should be of"
"type basestring")
max_lines = self._snippet.get('maxLines', None)
if max_lines is None:
return {'text': text}
Expand Down Expand Up @@ -490,7 +492,9 @@ def etree_element(self):
if isinstance(self.snippet, basestring):
snippet.text = self.snippet
else:
assert (isinstance(self.snippet['text'], basestring))
if not (isinstance(self.snippet['text'], basestring)):
raise TypeError("text snippet should be of"
"type basestring")
snippet.text = self.snippet['text']
if self.snippet.get('maxLines'):
snippet.set('maxLines', str(self.snippet['maxLines']))
Expand Down Expand Up @@ -641,7 +645,9 @@ def append(self, kmlobj):
"Features must be instances of "
"(Folder, Placemark, Document)"
)
assert(kmlobj != self)
if not (kmlobj != self):
raise AssertionError(" kml object should not be instance of class"
"(self)")


class _Overlay(_Feature):
Expand All @@ -656,7 +662,7 @@ class _Overlay(_Feature):

_color = None
# Color values expressed in hexadecimal notation, including opacity (alpha)
# values. The order of expression is alpOverlayha, blue, green, red
# values. The order of expression is alphaOverlay, blue, green, red
# (AABBGGRR). The range of values for any one color is 0 to 255 (00 to ff).
# For opacity, 00 is fully transparent and ff is fully opaque.

Expand Down Expand Up @@ -1098,7 +1104,7 @@ def from_element(self, element):

logger.warn('No geometries found')
logger.debug(u'Problem with element: {}'.format(etree.tostring(element)))
#raise ValueError('No geometries found')
# raise ValueError('No geometries found')

def etree_element(self):
element = super(Placemark, self).etree_element()
Expand Down

0 comments on commit e56b200

Please sign in to comment.