<commit_before>from __future__ import unicode_literals

from django.db import models
from home.models import VenuePage


class VenueDetailsManager(models.Manager):
    def create_venue(self, venue_page, place):
        venue, created = self.update_or_create(venue_page=venue_page)
        try:
            venue.place_id = place['place_id']
        except:
            pass
        try:
            venue.address = place['formatted_address']
        except:
            pass
        try:
            venue.phone = place['formatted_phone_number']
        except:
            pass
        try:
            venue.website = place['website']
        except:
            pass
        try:
            venue.gmaps_url = place['url']
        except:
            pass
        venue.save()
        return venue


class VenueDetails(models.Model):
    '''Model for saving the venue's details once
    the venue name is saved in the VenuePage'''
    venue_page = models.OneToOneField(
        VenuePage,
        models.CASCADE,
        related_name='venue_details')
    place_id = models.CharField(max_length=255, blank=True)
    address = models.CharField(max_length=100, blank=True)
    phone = models.CharField(max_length=30, blank=True)
    website = models.CharField(max_length=100, blank=True)
    gmaps_url = models.CharField(max_length=100, blank=True)

    objects = VenueDetailsManager()


class OpenHoursManager(models.Manager):
    def create_openhours(self, venue, day):
        open_hours_id = (str(day['open']['day']) + day['open']['time'] +
                         str(day['close']['day']) + day['close']['time'])
        open_hours, created = self.update_or_create(
            uuid=open_hours_id,
            venue=venue)
        open_hours.open_day = day['open']['day']
        open_hours.open_time = day['open']['time']
        open_hours.close_day = day['close']['day']
        open_hours.close_time = day['close']['time']
        open_hours.save()


class OpenHours(models.Model):
    '''Model for storing and processing Open Hours
    for presentation with the VenuePage model'''
    DAY_OF_WEEK_CHOICES = (
        ('0', 'Sunday'),<commit_msg>fix open hours exception<commit_after>from __future__ import unicode_literals

from django.db import models
from home.models import VenuePage


class VenueDetailsManager(models.Manager):
    def create_venue(self, venue_page, place):
        venue, created = self.update_or_create(venue_page=venue_page)
        try:
            venue.place_id = place['place_id']
        except:
            pass
        try:
            venue.address = place['formatted_address']
        except:
            pass
        try:
            venue.phone = place['formatted_phone_number']
        except:
            pass
        try:
            venue.website = place['website']
        except:
            pass
        try:
            venue.gmaps_url = place['url']
        except:
            pass
        venue.save()
        return venue


class VenueDetails(models.Model):
    '''Model for saving the venue's details once
    the venue name is saved in the VenuePage'''
    venue_page = models.OneToOneField(
        VenuePage,
        models.CASCADE,
        related_name='venue_details')
    place_id = models.CharField(max_length=255, blank=True)
    address = models.CharField(max_length=100, blank=True)
    phone = models.CharField(max_length=30, blank=True)
    website = models.CharField(max_length=100, blank=True)
    gmaps_url = models.CharField(max_length=100, blank=True)

    objects = VenueDetailsManager()


class OpenHoursManager(models.Manager):
    def create_openhours(self, venue, day):
        try: 
            open_hours_id = (str(day['open']['day']) + day['open']['time'] +
                            str(day['close']['day']) + day['close']['time'])
            open_hours, created = self.update_or_create(
                uuid=open_hours_id,
                venue=venue)
            open_hours.open_day = day['open']['day']
            open_hours.open_time = day['open']['time']
            open_hours.close_day = day['close']['day']
            open_hours.close_time = day['close']['time']
            open_hours.save()
        except KeyError:
            pass


class OpenHours(models.Model):
    '''Model for storing and processing Open Hours
    for presentation with the VenuePage model'''
    DAY_OF_WEEK_CHOICES = (
        ('0', 'Sunday'),
{'fraction_non_alphanumeric': 0.11090991398822997, 'fraction_numerical': 0.006790402897238569, 'mean_word_length': 2.425581395348837, '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': '315501', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1255, 'n_words': 268}