<s> import unittest <EOL> import env <EOL> import os <EOL> import shutil <EOL> import json <EOL> from time import sleep <EOL> from collections import namedtuple <EOL> from queue . scanner import Scanner <EOL> from queue . scanner import rf_table_name , lib_table_name <EOL> from index . index import Index <EOL> class TestIndexing ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> cls . db_dir = os . path . join ( <EOL> env . RESULTS_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> cls . suite_dir = os . path . join ( <EOL> env . TEST_DATA_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> scanner = Scanner ( ) <EOL> scanner . scan ( <EOL> cls . suite_dir , <EOL> '<STR_LIT>' , <EOL> cls . db_dir ) <EOL> cls . xml_libs = os . path . join ( <EOL> env . RESOURCES_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> def setUp ( self ) : <EOL> self . index_dir = os . path . join ( <EOL> env . RESULTS_DIR , <EOL> '<STR_LIT>' , <EOL> ) <EOL> if os . path . exists ( self . index_dir ) : <EOL> while os . path . exists ( self . index_dir ) : <EOL> shutil . rmtree ( self . index_dir ) <EOL> sleep ( <NUM_LIT:0.1> ) <EOL> os . makedirs ( self . index_dir ) <EOL> self . index = Index ( self . db_dir , self . index_dir ) <EOL> def test_parse_table_data ( self ) : <EOL> t_name = os . path . join ( <EOL> env . RESOURCES_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . index . queue . add ( t_name , None , None ) <EOL> data , status = self . index . read_table ( <EOL> os . path . join ( env . RESOURCES_DIR , t_name ) ) <EOL> var , kw_index = self . index . parse_table_data ( data , t_name ) <EOL> self . assertTrue ( u'<STR_LIT>' in var ) <EOL> self . assertTrue ( '<STR_LIT>' in var ) <EOL> self . assertTrue ( '<STR_LIT>' in var ) <EOL> def test_add_builtin ( self ) : <EOL> self . index . add_builtin_to_queue ( self . db_dir ) <EOL> self . assertTrue ( len ( self . index . queue . queue ) > <NUM_LIT:0> ) <EOL> def test_read_table ( self ) : <EOL> data , read_status = self . index . read_table ( <EOL> os . path . join ( <EOL> self . db_dir , <EOL> self . test_b_table_name ) ) <EOL> self . assertTrue ( data [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> def test_get_keywords_resource ( self ) : <EOL> data = self . get_resource_b ( ) <EOL> expected_kw_list = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> expected_arg_list = [ [ '<STR_LIT>' ] , [ ] ] <EOL> kw_list , arg_list = self . index . get_keywords ( data ) <EOL> self . assertEqual ( kw_list , expected_kw_list ) <EOL> self . assertEqual ( arg_list . sort ( ) , expected_arg_list . sort ( ) ) <EOL> data = self . get_test_a ( ) <EOL> expected_kw_list = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> kw_list , arg_list = self . index . get_keywords ( data ) <EOL> self . assertEqual ( kw_list , expected_kw_list ) <EOL> self . assertEqual ( arg_list , [ [ ] , [ ] ] ) <EOL> data = self . get_s2l ( ) <EOL> parsed_kw , arg_list = self . index . get_keywords ( data ) <EOL> self . assertTrue ( '<STR_LIT>' in parsed_kw ) <EOL> self . assertTrue ( '<STR_LIT>' in parsed_kw ) <EOL> self . assertTrue ( '<STR_LIT>' in parsed_kw ) <EOL> self . assertTrue ( [ '<STR_LIT:name>' ] in arg_list ) <EOL> l = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertTrue ( l in arg_list ) <EOL> self . assertTrue ( [ '<STR_LIT>' ] in arg_list ) <EOL> def test_get_imports ( self ) : <EOL> data = self . get_resource_b ( ) <EOL> import_list = [ self . process_table_name ] <EOL> self . assertEqual ( self . index . get_imports ( data ) , import_list ) <EOL> data = self . get_test_a ( ) <EOL> import_list = [ <EOL> self . common_table_name , <EOL> self . resource_a_table_name ] <EOL> self . assertEqual ( <EOL> self . index . get_imports ( data ) . sort ( ) , import_list . sort ( ) ) <EOL> data = self . get_s2l ( ) <EOL> self . assertEqual ( self . index . get_imports ( data ) , [ ] ) <EOL> def test_get_variables ( self ) : <EOL> data = self . get_resource_b ( ) <EOL> var = [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . index . get_variables ( data ) , var ) <EOL> data = self . get_test_a ( ) <EOL> var = [ '<STR_LIT>' ] <EOL> self . assertEqual ( <EOL> self . index . get_variables ( data ) . sort ( ) , var . sort ( ) ) <EOL> data = self . get_s2l ( ) <EOL> self . assertEqual ( self . index . get_variables ( data ) , [ ] ) <EOL> data = self . get_common ( ) <EOL> self . assertEqual ( self . index . get_variables ( data ) , [ ] ) <EOL> def test_get_kw_for_index ( self ) : <EOL> KeywordRecord = namedtuple ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> table_name = self . resource_b_table_name <EOL> l , kw_list , arg_list , object_name , table_name = self . get_resource_b_kw_index ( KeywordRecord ) <EOL> self . assertEqual ( <EOL> self . index . get_kw_for_index ( <EOL> kw_list , arg_list , table_name , object_name ) , l ) <EOL> l , kw_list , arg_list , object_name , table_name = self . get_test_a_kw_index ( KeywordRecord ) <EOL> self . assertEqual ( <EOL> self . index . get_kw_for_index ( <EOL> kw_list , arg_list , table_name , object_name ) , l ) <EOL> l , kw_list , arg_list , object_name , table_name = self . get_s2l_kw_index ( <EOL> KeywordRecord ) <EOL> self . assertEqual ( <EOL> self . index . get_kw_for_index ( <EOL> kw_list , arg_list , table_name , object_name ) , l ) <EOL> def test_index_creation_test_a ( self ) : <EOL> table_name = self . test_a_table_name <EOL> KeywordRecord = namedtuple ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> kw_list = [ ] <EOL> kw_list . extend ( self . get_test_a_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_common_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_resource_a_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_s2l_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_os_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_builtin_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_LibNoClass_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> var_list = [ <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' <EOL> ] <EOL> t_index = { <EOL> '<STR_LIT>' : kw_list , <EOL> '<STR_LIT>' : var_list } <EOL> r_index = self . index . create_index_for_table ( self . db_dir , table_name ) <EOL> self . assertEqual ( <EOL> r_index [ '<STR_LIT>' ] . sort ( ) , t_index [ '<STR_LIT>' ] . sort ( ) ) <EOL> self . assertEqual ( len ( r_index [ '<STR_LIT>' ] ) , len ( t_index [ '<STR_LIT>' ] ) ) <EOL> self . assertEqual ( r_index [ '<STR_LIT>' ] . sort ( ) , t_index [ '<STR_LIT>' ] . sort ( ) ) <EOL> def test_index_creation_test_b ( self ) : <EOL> table_name = self . test_b_table_name <EOL> KeywordRecord = namedtuple ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> kw_list = [ ] <EOL> kw_list . extend ( self . get_test_b_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_common_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_resource_b_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_s2l_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_process_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> kw_list . extend ( self . get_builtin_kw_index ( KeywordRecord ) [ <NUM_LIT:0> ] ) <EOL> var_list = [ <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' <EOL> ] <EOL> t_index = { <EOL> '<STR_LIT>' : kw_list , <EOL> '<STR_LIT>' : var_list } <EOL> r_index = self . index . create_index_for_table ( self . db_dir , table_name ) <EOL> self . assertEqual ( <EOL> r_index [ '<STR_LIT>' ] . sort ( ) , t_index [ '<STR_LIT>' ] . sort ( ) ) <EOL> self . assertEqual ( len ( r_index [ '<STR_LIT>' ] ) , len ( t_index [ '<STR_LIT>' ] ) ) <EOL> self . assertEqual ( r_index [ '<STR_LIT>' ] . sort ( ) , t_index [ '<STR_LIT>' ] . sort ( ) ) <EOL> def test_index_consturctor ( self ) : <EOL> self . index . index_consturctor ( self . resource_a_table_name ) <EOL> files = os . listdir ( self . index_dir ) <EOL> self . assertEqual ( len ( files ) , <NUM_LIT:1> ) <EOL> with open ( os . path . join ( self . index_dir , files [ <NUM_LIT:0> ] ) ) as f : <EOL> data = json . load ( f ) <EOL> self . assertIn ( '<STR_LIT>' , data ) <EOL> self . assertIn ( '<STR_LIT>' , data ) <EOL> self . assertFalse ( <EOL> any ( kw [ <NUM_LIT:0> ] == '<STR_LIT>' for kw in data [ '<STR_LIT>' ] ) <EOL> ) <EOL> self . assertTrue ( <EOL> any ( kw [ <NUM_LIT:0> ] == '<STR_LIT>' for kw in data [ '<STR_LIT>' ] ) <EOL> ) <EOL> def test_get_kw_arguments ( self ) : <EOL> kw_args = [ u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> result = self . index . get_kw_arguments ( kw_args ) <EOL> expected = [ u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> self . assertEqual ( result , expected ) <EOL> kw_args = [ u'<STR_LIT:name>' , u'<STR_LIT>' ] <EOL> result = self . index . get_kw_arguments ( kw_args ) <EOL> self . assertEqual ( result , kw_args ) <EOL> kw_args = [ ] <EOL> result = self . index . get_kw_arguments ( kw_args ) <EOL> self . assertEqual ( result , kw_args ) <EOL> kw_args = [ u'<STR_LIT>' , u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> result = self . index . get_kw_arguments ( kw_args ) <EOL> expected = [ u'<STR_LIT:object>' , u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> self . assertEqual ( result , expected ) <EOL> kw_args = [ u'<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> result = self . index . get_kw_arguments ( kw_args ) <EOL> expected = [ u'<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> self . assertEqual ( result , expected ) <EOL> def test_add_xml_libraries ( self ) : <EOL> self . assertEqual ( len ( self . index . queue . queue ) , <NUM_LIT:0> ) <EOL> self . index . add_xml_libraries ( self . xml_libs ) <EOL> self . assertEqual ( len ( self . index . queue . queue ) , <NUM_LIT:2> ) <EOL> def test_index_with_xml_libraries ( self ) : <EOL> xml_libs = os . path . join ( <EOL> env . RESOURCES_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> db_dir_with_xml = os . path . join ( <EOL> env . RESULTS_DIR , <EOL> '<STR_LIT>' ) <EOL> scanner = Scanner ( xml_libs ) <EOL> scanner . scan ( <EOL> self . suite_dir , <EOL> '<STR_LIT>' , <EOL> db_dir_with_xml <EOL> ) <EOL> index = Index ( db_dir_with_xml , self . index_dir , self . xml_libs ) <EOL> index . index_consturctor ( self . resource_a_table_name ) <EOL> files = os . listdir ( self . index_dir ) <EOL> self . assertEqual ( len ( files ) , <NUM_LIT:1> ) <EOL> with open ( os . path . join ( self . index_dir , files [ <NUM_LIT:0> ] ) ) as f : <EOL> data = json . load ( f ) <EOL> self . assertTrue ( <EOL> any ( kw [ <NUM_LIT:2> ] == '<STR_LIT>' for kw in data [ '<STR_LIT>' ] ) <EOL> ) <EOL> self . assertTrue ( <EOL> any ( kw [ <NUM_LIT:0> ] == '<STR_LIT>' for kw in data [ '<STR_LIT>' ] ) <EOL> ) <EOL> self . assertTrue ( <EOL> any ( kw [ <NUM_LIT:0> ] == '<STR_LIT>' for kw in data [ '<STR_LIT>' ] ) <EOL> ) <EOL> def test_get_object_name ( self ) : <EOL> object_name = self . index . get_object_name ( self . get_libnoclass ( ) ) <EOL> self . assertEqual ( object_name , '<STR_LIT>' ) <EOL> object_name = self . index . get_object_name ( self . get_resource_b ( ) ) <EOL> self . assertEqual ( object_name , '<STR_LIT>' ) <EOL> object_name = self . index . get_object_name ( self . get_os ( ) ) <EOL> self . assertEqual ( object_name , '<STR_LIT>' ) <EOL> object_name = self . index . get_object_name ( self . get_s2l ( ) ) <EOL> self . assertEqual ( object_name , '<STR_LIT>' ) <EOL> @ property <EOL> def common_table_name_index ( self ) : <EOL> index = '<STR_LIT>' . format ( self . common_table_name ) <EOL> return os . path . join ( self . index_dir , index ) <EOL> @ property <EOL> def test_a_table_name_index ( self ) : <EOL> index = '<STR_LIT>' . format ( self . test_a_table_name ) <EOL> return os . path . join ( self . index_dir , index ) <EOL> @ property <EOL> def real_suite_table_name ( self ) : <EOL> return rf_table_name ( <EOL> os . path . normcase ( <EOL> os . path . join ( <EOL> self . real_suite_dir , <EOL> '<STR_LIT:test>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> ) <EOL> ) <EOL> @ property <EOL> def resource_b_table_name ( self ) : <EOL> return rf_table_name ( <EOL> os . path . normcase ( os . path . join ( self . suite_dir , '<STR_LIT>' ) ) <EOL> ) <EOL> @ property <EOL> def common_table_name ( self ) : <EOL> return rf_table_name ( <EOL> os . path . normcase ( os . path . join ( self . suite_dir , '<STR_LIT>' ) ) <EOL> ) <EOL> @ property <EOL> def test_a_table_name ( self ) : <EOL> return rf_table_name ( <EOL> os . path . normcase ( os . path . join ( self . suite_dir , '<STR_LIT>' ) ) <EOL> ) <EOL> @ property <EOL> def test_b_table_name ( self ) : <EOL> return rf_table_name ( <EOL> os . path . normcase ( os . path . join ( self . suite_dir , '<STR_LIT>' ) ) <EOL> ) <EOL> @ property <EOL> def resource_a_table_name ( self ) : <EOL> return rf_table_name ( os . path . normcase ( <EOL> os . path . join ( self . suite_dir , '<STR_LIT>' ) ) <EOL> ) <EOL> @ property <EOL> def s2l_table_name ( self ) : <EOL> return lib_table_name ( '<STR_LIT>' ) <EOL> @ property <EOL> def os_table_name ( self ) : <EOL> return lib_table_name ( '<STR_LIT>' ) <EOL> @ property <EOL> def process_table_name ( self ) : <EOL> return lib_table_name ( '<STR_LIT>' ) <EOL> @ property <EOL> def builtin_table_name ( self ) : <EOL> return lib_table_name ( '<STR_LIT>' ) <EOL> @ property <EOL> def libnoclass_table_name ( self ) : <EOL> return lib_table_name ( '<STR_LIT>' ) <EOL> def get_resource_b ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . resource_b_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_common ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . common_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_test_a ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . test_a_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_s2l ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . s2l_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_os ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . os_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_process ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . process_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def getbuiltin ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . builtin_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_libnoclass ( self ) : <EOL> f = open ( os . path . join ( <EOL> self . db_dir , <EOL> self . libnoclass_table_name <EOL> ) <EOL> ) <EOL> return json . load ( f ) <EOL> def get_s2l_kw_index ( self , keywordrecord ) : <EOL> s2l_data = self . get_s2l ( ) <EOL> kw_list = self . index . get_keywords ( s2l_data ) [ <NUM_LIT:0> ] <EOL> arg_list = self . get_kw_args ( s2l_data ) <EOL> object_name = '<STR_LIT>' <EOL> table_name = self . s2l_table_name <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_os_kw_index ( self , keywordrecord ) : <EOL> os_data = self . get_os ( ) <EOL> kw_list = self . index . get_keywords ( os_data ) [ <NUM_LIT:0> ] <EOL> arg_list = self . get_kw_args ( os_data ) <EOL> object_name = '<STR_LIT>' <EOL> table_name = self . os_table_name <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_process_kw_index ( self , keywordrecord ) : <EOL> data = self . get_process ( ) <EOL> kw_list = self . index . get_keywords ( data ) [ <NUM_LIT:0> ] <EOL> arg_list = self . get_kw_args ( data ) <EOL> object_name = '<STR_LIT>' <EOL> table_name = self . process_table_name <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_builtin_kw_index ( self , keywordrecord ) : <EOL> data = self . getbuiltin ( ) <EOL> kw_list = self . index . get_keywords ( data ) [ <NUM_LIT:0> ] <EOL> arg_list = self . get_kw_args ( data ) <EOL> object_name = '<STR_LIT>' <EOL> table_name = self . builtin_table_name <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_LibNoClass_kw_index ( self , keywordrecord ) : <EOL> data = self . get_libnoclass ( ) <EOL> kw_list = self . index . get_keywords ( data ) [ <NUM_LIT:0> ] <EOL> arg_list = self . get_kw_args ( data ) <EOL> object_name = '<STR_LIT>' <EOL> table_name = self . libnoclass_table_name <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_test_a_kw_index ( self , keywordrecord ) : <EOL> kw_list = [ u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> arg_list = [ None , None ] <EOL> table_name = self . test_a_table_name <EOL> object_name = u'<STR_LIT>' <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_test_b_kw_index ( self , keywordrecord ) : <EOL> kw_list = [ ] <EOL> table_name = self . test_b_table_name <EOL> object_name = u'<STR_LIT>' <EOL> l = [ ] <EOL> return l , kw_list , [ None ] , object_name , table_name <EOL> def get_resource_a_kw_index ( self , keywordrecord ) : <EOL> kw_list = [ u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> arg_list = [ '<STR_LIT>' , None ] <EOL> table_name = self . resource_a_table_name <EOL> object_name = u'<STR_LIT>' <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_resource_b_kw_index ( self , keywordrecord ) : <EOL> kw_list = [ u'<STR_LIT>' , u'<STR_LIT>' ] <EOL> arg_list = [ '<STR_LIT>' , None ] <EOL> table_name = self . resource_b_table_name <EOL> object_name = u'<STR_LIT>' <EOL> l = [ ] <EOL> for kw , arg in zip ( kw_list , arg_list ) : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = arg , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , arg_list , object_name , table_name <EOL> def get_common_kw_index ( self , keywordrecord ) : <EOL> kw_list = [ <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' , <EOL> u'<STR_LIT>' <EOL> ] <EOL> table_name = self . common_table_name <EOL> object_name = u'<STR_LIT>' <EOL> l = [ ] <EOL> for kw in kw_list : <EOL> l . append ( <EOL> keywordrecord ( <EOL> keyword = kw , <EOL> argument = None , <EOL> object_name = object_name , <EOL> table_name = table_name <EOL> ) <EOL> ) <EOL> return l , kw_list , [ None ] , object_name , table_name <EOL> def get_kw_args ( self , data ) : <EOL> arg_list = [ ] <EOL> kws = data [ "<STR_LIT>" ] <EOL> for i in kws . iterkeys ( ) : <EOL> args = kws [ i ] [ '<STR_LIT>' ] <EOL> for arg in args : <EOL> if '<STR_LIT:=>' in arg : <EOL> arg_list . append ( arg . split ( '<STR_LIT:=>' ) [ <NUM_LIT:0> ] ) <EOL> else : <EOL> arg_list . append ( arg ) <EOL> return arg_list </s>
