Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class GPX:
gpx_10_fields = [
mod_gpxfield.GPXField('version', attribute=True),
mod_gpxfield.GPXField('creator', attribute=True),
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('author_name', 'author'),
mod_gpxfield.GPXField('author_email', 'email'),
mod_gpxfield.GPXField('link', 'url'),
mod_gpxfield.GPXField('link_text', 'urlname'),
mod_gpxfield.GPXField('time', type=mod_gpxfield.TIME_TYPE),
mod_gpxfield.GPXField('keywords'),
mod_gpxfield.GPXComplexField('bounds', classs=GPXBounds),
mod_gpxfield.GPXComplexField('waypoints', classs=GPXWaypoint, tag='wpt', is_list=True),
mod_gpxfield.GPXComplexField('routes', classs=GPXRoute, tag='rte', is_list=True),
mod_gpxfield.GPXComplexField('tracks', classs=GPXTrack, tag='trk', is_list=True),
]
# Text fields serialize as empty container tags, dependents are
# are listed after as 'tag:dep1:dep2:dep3'. If no dependents are
# listed, it will always serialize. The container is closed with
# '/tag'. Required dependents are preceded by an @. If a required
# dependent is empty, nothing in the container will serialize. The
# format is 'tag:@dep2'. No optional dependents need to be listed.
# Extensions not yet supported
gpx_11_fields = [
mod_gpxfield.GPXField('version', attribute=True),
mod_gpxfield.GPXField('creator', attribute=True),
'metadata:name:description:author_name:author_email:author_link:copyright_author:copyright_year:copyright_license:link:time:keywords:bounds',
mod_gpxfield.GPXField('name', 'name'),
mod_gpxfield.GPXField('description', 'desc'),
'author:author_name:author_email:author_link',
mod_gpxfield.GPXField('author_name', 'name'),
mod_gpxfield.GPXField('author_link_type', tag='type'),
'/link',
'/author',
'copyright:copyright_author:copyright_year:copyright_license',
mod_gpxfield.GPXField('copyright_author', attribute='author'),
mod_gpxfield.GPXField('copyright_year', tag='year'),
mod_gpxfield.GPXField('copyright_license', tag='license'),
'/copyright',
'link:@link',
mod_gpxfield.GPXField('link', attribute='href'),
mod_gpxfield.GPXField('link_text', tag='text'),
mod_gpxfield.GPXField('link_type', tag='type'),
'/link',
mod_gpxfield.GPXField('time', type=mod_gpxfield.TIME_TYPE),
mod_gpxfield.GPXField('keywords'),
mod_gpxfield.GPXComplexField('bounds', classs=GPXBounds),
mod_gpxfield.GPXExtensionsField('metadata_extensions', tag='extensions'),
'/metadata',
mod_gpxfield.GPXComplexField('waypoints', classs=GPXWaypoint, tag='wpt', is_list=True),
mod_gpxfield.GPXComplexField('routes', classs=GPXRoute, tag='rte', is_list=True),
mod_gpxfield.GPXComplexField('tracks', classs=GPXTrack, tag='trk', is_list=True),
mod_gpxfield.GPXExtensionsField('extensions', is_list=True),
]
__slots__ = ('version', 'creator', 'name', 'description', 'author_name',
'author_email', 'link', 'link_text', 'time', 'keywords',
'bounds', 'waypoints', 'routes', 'tracks', 'author_link',
'author_link_text', 'author_link_type', 'copyright_author',
'copyright_year', 'copyright_license', 'link_type',
'metadata_extensions', 'extensions', 'nsmap',
'schema_locations')
]
gpx_11_fields = [
# See GPX for text field description
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('comment', 'cmt'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('source', 'src'),
'link:@link',
mod_gpxfield.GPXField('link', attribute='href'),
mod_gpxfield.GPXField('link_text', tag='text'),
mod_gpxfield.GPXField('link_type', tag='type'),
'/link',
mod_gpxfield.GPXField('number', type=mod_gpxfield.INT_TYPE),
mod_gpxfield.GPXField('type'),
mod_gpxfield.GPXExtensionsField('extensions', is_list=True),
mod_gpxfield.GPXComplexField('segments', tag='trkseg', classs=GPXTrackSegment, is_list=True),
]
__slots__ = ('name', 'comment', 'description', 'source', 'link',
'link_text', 'number', 'segments', 'link_type', 'type',
'extensions')
def __init__(self, name=None, description=None, number=None):
self.name = name
self.comment = None
self.description = description
self.source = None
self.link = None
self.link_text = None
self.number = number
self.segments = []
self.link_type = None
mod_gpxfield.GPXField('copyright_author', attribute='author'),
mod_gpxfield.GPXField('copyright_year', tag='year'),
mod_gpxfield.GPXField('copyright_license', tag='license'),
'/copyright',
'link:@link',
mod_gpxfield.GPXField('link', attribute='href'),
mod_gpxfield.GPXField('link_text', tag='text'),
mod_gpxfield.GPXField('link_type', tag='type'),
'/link',
mod_gpxfield.GPXField('time', type=mod_gpxfield.TIME_TYPE),
mod_gpxfield.GPXField('keywords'),
mod_gpxfield.GPXComplexField('bounds', classs=GPXBounds),
mod_gpxfield.GPXExtensionsField('metadata_extensions', tag='extensions'),
'/metadata',
mod_gpxfield.GPXComplexField('waypoints', classs=GPXWaypoint, tag='wpt', is_list=True),
mod_gpxfield.GPXComplexField('routes', classs=GPXRoute, tag='rte', is_list=True),
mod_gpxfield.GPXComplexField('tracks', classs=GPXTrack, tag='trk', is_list=True),
mod_gpxfield.GPXExtensionsField('extensions', is_list=True),
]
__slots__ = ('version', 'creator', 'name', 'description', 'author_name',
'author_email', 'link', 'link_text', 'time', 'keywords',
'bounds', 'waypoints', 'routes', 'tracks', 'author_link',
'author_link_text', 'author_link_type', 'copyright_author',
'copyright_year', 'copyright_license', 'link_type',
'metadata_extensions', 'extensions', 'nsmap',
'schema_locations')
def __init__(self):
self.version = None
self.creator = None
self.name = None
class GPX:
gpx_10_fields = [
mod_gpxfield.GPXField('version', attribute=True),
mod_gpxfield.GPXField('creator', attribute=True),
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('author_name', 'author'),
mod_gpxfield.GPXField('author_email', 'email'),
mod_gpxfield.GPXField('link', 'url'),
mod_gpxfield.GPXField('link_text', 'urlname'),
mod_gpxfield.GPXField('time', type=mod_gpxfield.TIME_TYPE),
mod_gpxfield.GPXField('keywords'),
mod_gpxfield.GPXComplexField('bounds', classs=GPXBounds),
mod_gpxfield.GPXComplexField('waypoints', classs=GPXWaypoint, tag='wpt', is_list=True),
mod_gpxfield.GPXComplexField('routes', classs=GPXRoute, tag='rte', is_list=True),
mod_gpxfield.GPXComplexField('tracks', classs=GPXTrack, tag='trk', is_list=True),
]
# Text fields serialize as empty container tags, dependents are
# are listed after as 'tag:dep1:dep2:dep3'. If no dependents are
# listed, it will always serialize. The container is closed with
# '/tag'. Required dependents are preceded by an @. If a required
# dependent is empty, nothing in the container will serialize. The
# format is 'tag:@dep2'. No optional dependents need to be listed.
# Extensions not yet supported
gpx_11_fields = [
mod_gpxfield.GPXField('version', attribute=True),
mod_gpxfield.GPXField('creator', attribute=True),
'metadata:name:description:author_name:author_email:author_link:copyright_author:copyright_year:copyright_license:link:time:keywords:bounds',
mod_gpxfield.GPXField('name', 'name'),
mod_gpxfield.GPXField('description', 'desc'),
return 'GPXTrackSegment(points=[%s])' % ('...' if self.points else '')
def clone(self):
return mod_copy.deepcopy(self)
class GPXTrack:
gpx_10_fields = [
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('comment', 'cmt'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('source', 'src'),
mod_gpxfield.GPXField('link', 'url'),
mod_gpxfield.GPXField('link_text', 'urlname'),
mod_gpxfield.GPXField('number', type=mod_gpxfield.INT_TYPE),
mod_gpxfield.GPXComplexField('segments', tag='trkseg', classs=GPXTrackSegment, is_list=True),
]
gpx_11_fields = [
# See GPX for text field description
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('comment', 'cmt'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('source', 'src'),
'link:@link',
mod_gpxfield.GPXField('link', attribute='href'),
mod_gpxfield.GPXField('link_text', tag='text'),
mod_gpxfield.GPXField('link_type', tag='type'),
'/link',
mod_gpxfield.GPXField('number', type=mod_gpxfield.INT_TYPE),
mod_gpxfield.GPXField('type'),
mod_gpxfield.GPXExtensionsField('extensions', is_list=True),
mod_gpxfield.GPXComplexField('segments', tag='trkseg', classs=GPXTrackSegment, is_list=True),
def remove_time(self):
""" Will remove time metadata. """
self.time = None
class GPXRoute:
gpx_10_fields = [
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('comment', 'cmt'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('source', 'src'),
mod_gpxfield.GPXField('link', 'url'),
mod_gpxfield.GPXField('link_text', 'urlname'),
mod_gpxfield.GPXField('number', type=mod_gpxfield.INT_TYPE),
mod_gpxfield.GPXComplexField('points', tag='rtept', classs=GPXRoutePoint, is_list=True),
]
gpx_11_fields = [
# See GPX for description of text fields
mod_gpxfield.GPXField('name'),
mod_gpxfield.GPXField('comment', 'cmt'),
mod_gpxfield.GPXField('description', 'desc'),
mod_gpxfield.GPXField('source', 'src'),
'link:@link',
mod_gpxfield.GPXField('link', attribute='href'),
mod_gpxfield.GPXField('link_text', tag='text'),
mod_gpxfield.GPXField('link_type', tag='type'),
'/link',
mod_gpxfield.GPXField('number', type=mod_gpxfield.INT_TYPE),
mod_gpxfield.GPXField('type'),
mod_gpxfield.GPXExtensionsField('extensions', is_list=True),
mod_gpxfield.GPXComplexField('points', tag='rtept', classs=GPXRoutePoint, is_list=True),