<commit_before>from gntp import *
import Growl

def register_send(self):
	'''
	Resend a GNTP Register message to Growl running on a local OSX Machine
	'''
	print 'Sending Local Registration'
	
	#Local growls only need a list of strings
	notifications=[]
	defaultNotifications = []
	for notice in self.notifications:
		notifications.append(notice['Notification-Name'])
		if notice.get('Notification-Enabled',True):
			defaultNotifications.append(notice['Notification-Name'])
	
	appIcon = self.headers.get('Application-Icon',None)
	if appIcon.startswith('x-growl-resource://'):
		resource = appIcon.split('://')
		appIcon = self.resources.get(resource[1])['Data']
	else:
		#Ignore URLs for now
		appIcon = None
	
	growl = Growl.GrowlNotifier(
		applicationName			= self.headers['Application-Name'],
		notifications			= notifications,
		defaultNotifications	= defaultNotifications,
		applicationIcon			= appIcon,
	)
	growl.register()
	return self.encode()
	
def notice_send(self):
	'''
	Resend a GNTP Notify message to Growl running on a local OSX Machine
	'''
	print 'Sending Local Notification'
	growl = Growl.GrowlNotifier(
		applicationName			= self.headers['Application-Name'],
		notifications			= [self.headers['Notification-Name']]
	)
	
	noticeIcon = self.headers.get('Notification-Icon',None)
	if noticeIcon.startswith('x-growl-resource://'):
		resource = noticeIcon.split('://')<commit_msg>If I'm using startswith to check, then I need to make sure I have a string.<commit_after>from gntp import *
import Growl

def register_send(self):
	'''
	Resend a GNTP Register message to Growl running on a local OSX Machine
	'''
	print 'Sending Local Registration'
	
	#Local growls only need a list of strings
	notifications=[]
	defaultNotifications = []
	for notice in self.notifications:
		notifications.append(notice['Notification-Name'])
		if notice.get('Notification-Enabled',True):
			defaultNotifications.append(notice['Notification-Name'])
	
	appIcon = self.headers.get('Application-Icon','')
	if appIcon.startswith('x-growl-resource://'):
		resource = appIcon.split('://')
		appIcon = self.resources.get(resource[1])['Data']
	else:
		#Ignore URLs for now
		appIcon = None
	
	growl = Growl.GrowlNotifier(
		applicationName			= self.headers['Application-Name'],
		notifications			= notifications,
		defaultNotifications	= defaultNotifications,
		applicationIcon			= appIcon,
	)
	growl.register()
	return self.encode()
	
def notice_send(self):
	'''
	Resend a GNTP Notify message to Growl running on a local OSX Machine
	'''
	print 'Sending Local Notification'
	growl = Growl.GrowlNotifier(
		applicationName			= self.headers['Application-Name'],
		notifications			= [self.headers['Notification-Name']]
	)
	
	noticeIcon = self.headers.get('Notification-Icon','')
	if noticeIcon.startswith('x-growl-resource://'):
		resource = noticeIcon.split('://')
{'fraction_non_alphanumeric': 0.12596491228070175, 'fraction_numerical': 0.0007017543859649122, 'mean_word_length': 4.806517311608961, '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': '3571363', 'n_tokens_mistral': 953, 'n_tokens_neox': 885, 'n_words': 216}