<commit_before>#!/usr/bin/env python

import sys, os, random

from pprint import pprint

from LunchPlace import LunchPlace
from LunchVisit import LunchVisit
from LuncherPreferences import LuncherPreferences

def read_places(filename):
    places = []
    with open(filename) as f:
        for line in f:
            line = line.strip()
            if line.startswith('#'):
                continue

            fields = line.split(',')
            name = fields[0]
            tags = fields[1:]
            place = LunchPlace(name)
            for tag in tags:
                place.add_tag(tag)
            places.append(place)
    return places

def read_history(filename):
    history = []
    with open(filename) as f:
        for line in f:
            line = line.strip()
            if line.startswith('#'):
                continue

            date, name = line.split(',')
            visit = LunchVisit(name, date)
            history.append(visit)
    return history
<commit_msg>added check to make sure we don't have multiple places with the same name<commit_after>#!/usr/bin/env python

import sys, os, random

from pprint import pprint

from LunchPlace import LunchPlace
from LunchVisit import LunchVisit
from LuncherPreferences import LuncherPreferences

def read_places(filename):
    placenames = {}
    places = []
    with open(filename) as f:
        for line in f:
            line = line.strip()
            if line.startswith('#'):
                continue

            fields = line.split(',')
            name = fields[0]
            tags = fields[1:]

            if name in placenames:
                continue
            placenames[name] = True

            place = LunchPlace(name)
            for tag in tags:
                place.add_tag(tag)
            places.append(place)
    return places

def read_history(filename):
    history = []
    with open(filename) as f:
        for line in f:
            line = line.strip()
            if line.startswith('#'):
                continue

            date, name = line.split(',')
            visit = LunchVisit(name, date)
            history.append(visit)
    return history

{'fraction_non_alphanumeric': 0.08804448563484708, 'fraction_numerical': 0.0018535681186283596, 'mean_word_length': 1.7715019255455713, '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': '1491494', 'n_tokens_mistral': 606, 'n_tokens_neox': 575, 'n_words': 179}