<commit_before>'''
Created on Mar 10, 2012

@author: rcs
'''

import headerspace.headerspace.tf as tf
import headerspace.config_parser.openflow_parser as of

def generate_TTF(all_links):
  ''' Takes a list of debugger.debugger_entities.Link objects (directed) '''
  ttf = tf.TF(of.HS_FORMAT()["length"]*2)
  
  for link in all_links:
    uniq_from_port = of.get_uniq_port_id(link.start_switch_impl, link.start_port)
    uniq_to_port = of.get_uniq_port_id(link.end_switch_impl, link.end_port)
    rule = tf.TF.create_standard_rule([uniq_from_port], None,[uniq_to_port], None, None)
    ttf.add_link_rule(rule)
    
  return ttf<commit_msg>hsa.topo_loader: adding generate_NTF()<commit_after>'''
Created on Mar 10, 2012

@author: rcs
'''

import headerspace.headerspace.tf as tf
import headerspace.config_parser.openflow_parser as of

def generate_TTF(all_links):
  ''' Takes a list of debugger.debugger_entities.Link objects (directed) '''
  ttf = tf.TF(of.HS_FORMAT()["length"]*2)
  
  for link in all_links:
    uniq_from_port = of.get_uniq_port_id(link.start_switch_impl, link.start_port)
    uniq_to_port = of.get_uniq_port_id(link.end_switch_impl, link.end_port)
    rule = tf.TF.create_standard_rule([uniq_from_port], None,[uniq_to_port], None, None)
    ttf.add_link_rule(rule)
    
  return ttf

def generate_NTF(switches):
  ntf = tf.TF(of.HS_FORMAT()["length"]*2)
  for switch in switches:
    of.generate_transfer_function(ntf, switch) 
  return ntf
    
{'fraction_non_alphanumeric': 0.11475409836065574, 'fraction_numerical': 0.010245901639344262, 'mean_word_length': 5.02880658436214, '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': '2268525', 'n_tokens_mistral': 573, 'n_tokens_neox': 556, 'n_words': 103}