<commit_before>from django.contrib.gis.db.models.fields import LineStringField
from django.contrib.gis.db.models.manager import GeoManager
from django.db import models, models
from django.utils.translation import ugettext_lazy as _



class Trail(models.Model):
    '''
    Representation of a muni track.
    '''
    name = models.CharField(_('name'), max_length=100)
    created = models.DateTimeField(_('created'), auto_now_add=True, blank=True)
    edited = models.DateTimeField(_('last change'), auto_now=True, blank=True)
    description = models.CharField(_('description'), max_length=500, blank=True)
    waypoints = LineStringField(_('waypoints'), dim=3, null=True, blank=True) #include altitude as Z
    objects = GeoManager()
    # user
    # comments[]
    # country
    # unitours link
    # pictures[]
    
    def __unicode__(self):
        return u'%s' % self.name
<commit_msg>add method signatures to trail model<commit_after>from django.contrib.gis.db.models.fields import LineStringField
from django.contrib.gis.db.models.manager import GeoManager
from django.db import models, models
from django.utils.translation import ugettext_lazy as _



class Trail(models.Model):
    '''
    Representation of a muni track.
    '''
    name = models.CharField(_('name'), max_length=100)
    created = models.DateTimeField(_('created'), auto_now_add=True, blank=True)
    edited = models.DateTimeField(_('last change'), auto_now=True, blank=True)
    description = models.CharField(_('description'), max_length=500, blank=True)
    waypoints = LineStringField(_('waypoints'), dim=3, null=True, blank=True) #include altitude as Z
    objects = GeoManager()
    # user
    # comments[]
    # country
    # unitours link
    # pictures[]
    
    def __unicode__(self):
        return u'%s' % self.name
    
    def has_waypoints(self):
        return self.waypoints is not None
    
    def get_altitude_difference(self):
        '''
        Calculates the total altitude difference between start and end point.
        Ignores ups and downs in between.
        '''
        #TODO
        
    def get_max_slope(self):
        '''
        Calculates the slope in % for each pair of waypoints and returns
        the highest slope found.
        '''
        
    def get_avg_slope(self):
        '''
        Calculates the average slope by dividing total altitude difference
        through the length of the track.
        '''
        
    def get_length(self):
        '''
        Calculates the (flat) distance of the track.
        This does not take into account that the earth isn't flat, and that
        the distance should be longer due to the altitude difference.
        '''
        
    def get_exact_length(self):
        '''
        Calculates the length of the track and takes into account that
        the earth is not flat + altitude difference.
        '''
        
    def get_total_altitude_up(self):
        '''
        Calculates the total uphill meters (altitude)
        '''
        #TODO
        
    def get_total_altitude_down(self):
        '''
        Calculates the total downhill meters (altitude)
        '''
        #TODO
        

{'fraction_non_alphanumeric': 0.09561375828337015, 'fraction_numerical': 0.004417797412432944, 'mean_word_length': 2.681765389082462, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1265975', 'n_tokens_mistral': 913, 'n_tokens_neox': 878, 'n_words': 261}