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

Created by <NAME> on 2012-07-20.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""

from struct import unpack

from exabgp.protocol.ip.address import Address

class RouteEOR (object):
	PREFIX = '\x00\x00\x00\x07\x90\x0f\x00\x03'

	def __init__ (self,afi,safi,action):
		self.nlri = Address(afi,safi)
		self.action = action

	def pack (self):
		return self.PREFIX + self.nlri.afi.pack() + self.nlri.safi.pack()

	def __str__ (self):
		return '%s eor %d/%d (%s %s)' % (self.action,self.nlri.afi,self.nlri.safi,self.nlri.afi,self.nlri.safi)

def announcedRouteEOR (data):
	return RouteEOR(unpack('!H',data[-4:-2])[0],unpack('!H',data[-2:])[0],'announced')<commit_msg>missed API for parsing EOR<commit_after>#!/usr/bin/env python
# encoding: utf-8
"""
route.py

Created by <NAME> on 2012-07-20.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""

from struct import unpack

from exabgp.protocol.ip.address import Address

class RouteEOR (object):
	PREFIX = '\x00\x00\x00\x07\x90\x0f\x00\x03'

	def __init__ (self,afi,safi,action):
		self.nlri = Address(afi,safi)
		self.action = action
		self.attributes = None  # API compatibility with Route

	def pack (self):
		return self.PREFIX + self.nlri.afi.pack() + self.nlri.safi.pack()

	def __str__ (self):
		return '%s eor %d/%d (%s %s)' % (self.action,self.nlri.afi,self.nlri.safi,self.nlri.afi,self.nlri.safi)

	def extensive (self):
		return str(self)

def announcedRouteEOR (data):
	return RouteEOR(unpack('!H',data[-4:-2])[0],unpack('!H',data[-2:])[0],'announced')
{'fraction_non_alphanumeric': 0.17570093457943925, 'fraction_numerical': 0.04610591900311527, 'mean_word_length': 4.5, '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': '4811492', 'n_tokens_mistral': 702, 'n_tokens_neox': 657, 'n_words': 134}