<commit_before>#!/usr/bin/env python
# encoding: utf-8
"""
parser.py

Created by <NAME> on 2008-12-17.
Copyright (c) 2008 Exa Networks. All rights reserved.
See LICENSE for details.
"""

from scavenger.message import FactoryError

class Parser (object):
	def __init__ (self,factory=None,debug=False):
		self.debug = debug
		self._factory = factory

	def parse (self,data):
		message = {}
		valid = False
		for line in data.split('\n'):
			line = line.strip()
			if self.debug:
				print 'line', line
			if line == '':
				valid = True
				break
			part = line.split('=')
			if len(part) != 2:
				if self.debug:
					print 'invalid line [%s]' % line
				break
			k,v = part
			message[k] = v

		if not valid:
			return None<commit_msg>add missed change in last commit<commit_after>#!/usr/bin/env python
# encoding: utf-8
"""
parser.py

Created by <NAME> on 2008-12-17.
Copyright (c) 2008 Exa Networks. All rights reserved.
See LICENSE for details.
"""

from scavenger.message import Message, FactoryError

class Parser (object):
	def __init__ (self,factory=None,debug=False):
		self.debug = debug
		self._factory = factory

	def parse (self,data):
		message = Message()
		valid = False
		for line in data.split('\n'):
			line = line.strip()
			if self.debug:
				print 'line', line
			if line == '':
				valid = True
				break
			part = line.split('=')
			if len(part) != 2:
				if self.debug:
					print 'invalid line [%s]' % line
				break
			k,v = part
			message[k] = v

		if not valid:
			return None
{'fraction_non_alphanumeric': 0.13222591362126246, 'fraction_numerical': 0.018604651162790697, 'mean_word_length': 3.016, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7623960', 'n_tokens_mistral': 621, 'n_tokens_neox': 508, 'n_words': 166}