Best Python code snippet using toolium_python
chess.py
Source:chess.py
...91 # rank = row numbers92 def get_rank(self, location):93 return int(location[1])94 # file = column letters95 def get_file(self, location):96 return location[0]97 # info : {from: str, to: str}98 def move(self,info):99 if self.is_valid_move(info) is False:100 print("Not valid mve~")101 return -1102 p = self.board[info['from']]103 self.board[info['from']] = 0104 self.board[info['to']] = p105 self.board[info['to']]['location'] = info['to']106 if p['is_player']:107 print("is player")108 for _p in self.w_pieces:109 if _p['location'] == info['from']:110 print('location is from')111 _p['location'] = info['to']112 113 114 # helper115 def get_rank_distance(self, info):116 return abs(self.get_rank(info['to']) - self.get_rank(info['from']))117 118 def check_next_file(self, info):119 if info['from'] == 'H':120 return -1121 # print("a:", chr(ord(self.get_file(info['from'])) + 1))122 # print(info)123 print("info[from] is ", info['from'], "Get file:", self.get_file(info['to']), "returning", chr(ord(self.get_file(info['from'])) + 1))124 return chr(ord(self.get_file(info['from'])) + 1)125 126 def check_prev_file(self, info):127 if info['from'] == 'A':128 return -1129 return chr(ord(self.get_file(info['from'])) - 1)130 131 def square_occupied(self, info):132 if self.board[info['to']] == 0:133 return False134 return True135 # info {from: str, to: str}136 def is_valid_move(self, info):137 p = self.board[info['from']]138 # Pawn139 if p['type'] == 'P':140 print("MOVING PAWN")141 # if p['is_player']:142 if self.get_rank_distance(info) == 1:143 #move forward 1 without taking144 if self.get_file(info['from']) == self.get_file(info['to']):145 if not self.square_occupied(info):146 print("VALID MOVE 1 up")147 return True148 # move foward 1 (diag) to take149 # take to right150 elif self.check_next_file(info) == self.get_file(info['to']):151 print("VALID MOVE ready to take")152 if self.board[info['to']]['is_player'] != self.board[info['from']]['is_player']:153 print("TAKING PIECE")154 return True155 # if self.square_occupied(info) and not self.board[info['to']]['is_player']:156 # return True157 # take to left158 elif self.check_prev_file(info) == self.get_file(info['to']):159 print("VALID MOVE READU TO TALE LEFT")160 #bunch of extra useless checks?161 if self.board[info['to']]['is_player'] != self.board[info['from']]['is_player']:162 print("TAKING PIECE")163 return True164 # if self.square_occupied(info) and self.board[info['to']]['is_player'] != self.board[info['from']]['is_player']:165 # print("TAKING PIECE")166 # return True167 else:168 return False169 elif self.get_rank_distance(info) == 2:170 #move forward 2 without taking171 if self.get_file(info['from']) == self.get_file(info['to']):172 if self.board[info['to']] == 0:173 print("VALID MOVE up 2")174 return True175 176 if p['type'] == 'B':177 print("moving bishop")178 x2_minus_x1 = abs(ord(self.get_file(info['to'])) - ord(self.get_file(info['from'])))179 y2_minus_y1 = abs(self.get_rank(info['to']) - self.get_rank(info['from']))180 if x2_minus_x1 == y2_minus_y1:181 if chr(ord(self.get_file(info['to']))) < chr(ord(self.get_file(info['from']))):182 # going to left183 if self.get_rank(info['from']) < self.get_rank(info['to']):184 # going positive185 return self.mover.diag_left_positive(info, self.board, x2_minus_x1)186 elif self.get_rank(info['from']) > self.get_rank(info['to']):187 # going negative188 return self.mover.diag_left_negative(info, self.board, x2_minus_x1)189 elif chr(ord(self.get_file(info['to']))) > chr(ord(self.get_file(info['from']))):190 # going right191 if self.get_rank(info['from']) < self.get_rank(info['to']):192 return self.mover.diag_right_positive(info, self.board, x2_minus_x1)193 elif self.get_rank(info['from']) > self.get_rank(info['to']):194 # going negative195 return self.mover.diag_right_negative(info, self.board,x2_minus_x1)196 return True197 if p['type'] == 'K':198 # print(self.mover.get_file(info['to']))199 # print((self.mover.get_file(['from'])))200 if abs( ord(self.mover.get_file(info['to'])) - ord(self.mover.get_file(info['from'])) ) > 1 :201 print("cant move king 1")202 return False203 if abs(self.mover.get_rank(info['to']) - self.mover.get_rank(info['from'])) > 1:204 print("cant move king 2")205 return False206 if self.board[(self.mover.get_file(info['to'])) + str(self.mover.get_rank(info['to']))] != 0:207 if self.board[(self.mover.get_file(info['to'])) + str(self.mover.get_rank(info['to']))]['is_player'] != self.board[info['from']]['is_player']:208 return False209 else:210 return self.mover.king_can_move(info, self.board)211 212 if p['type'] == 'Q':213 # move on same column214 if self.mover.get_file(info['to']) == self.mover.get_file(info['from']):215 #move up board216 if self.mover.get_rank(info['from']) < self.mover.get_rank(info['to']):217 return self.mover.up_board(info, self.board)218 elif self.mover.get_rank(info['from']) > self.mover.get_rank(info['to']):219 return self.mover.down_board(info, self.board)220 # move left or right221 elif self.mover.get_rank(info['to']) == self.mover.get_rank(info['from']):222 if ord(self.mover.get_file(info['from'])) < ord(self.mover.get_file(info['to'])):223 return self.mover.up_board(info, self.board)224 elif ord(self.mover.get_file(info['from'])) > ord(self.mover.get_file(info['to'])):225 return self.mover.down_board(info, self.board)226 else:227 x2_minus_x1 = abs(ord(self.get_file(info['to'])) - ord(self.get_file(info['from'])))228 y2_minus_y1 = abs(self.get_rank(info['to']) - self.get_rank(info['from']))229 if x2_minus_x1 == y2_minus_y1:230 if chr(ord(self.get_file(info['to']))) < chr(ord(self.get_file(info['from']))):231 # going to left232 if self.get_rank(info['from']) < self.get_rank(info['to']):233 # going positive234 return self.mover.diag_left_positive(info, self.board, x2_minus_x1)235 elif self.get_rank(info['from']) > self.get_rank(info['to']):236 # going negative237 return self.mover.diag_left_negative(info, self.board, x2_minus_x1)238 elif chr(ord(self.get_file(info['to']))) > chr(ord(self.get_file(info['from']))):239 # going right240 if self.get_rank(info['from']) < self.get_rank(info['to']):241 return self.mover.diag_right_positive(info, self.board, x2_minus_x1)242 elif self.get_rank(info['from']) > self.get_rank(info['to']):243 # going negative244 return self.mover.diag_right_negative(info, self.board,x2_minus_x1)245 return True246 if p['type'] == 'N':247 return self.mover.hook(info, self.board)248 if p['type'] == 'R':249 print("moving rook")250 # Same file so same column251 if self.mover.get_file(info['from']) == self.mover.get_file(info['to']):252 if self.mover.get_rank(info['from']) < self.mover.get_rank(info['to']):253 return self.mover.up_board(info, self.board)254 elif self.mover.get_rank(info['from']) > self.mover.get_rank(info['to']):255 return self.mover.down_board(info, self.board)256 elif self.mover.get_rank(info['from']) == self.mover.get_rank(info['to']):257 print("rank from:", self.mover.get_rank(info['from']), "rank to:", self.mover.get_rank(info['to']))258 if ord(self.mover.get_file(info['from'])) < ord(self.mover.get_file(info['to'])):259 return self.mover.right_board(info, self.board)260 elif ord(self.mover.get_file(info['from'])) > ord(self.mover.get_file(info['to'])):261 return self.mover.left_board(info, self.board)262 print("NOT VALID MOVE")263 return False264 def init_pieces(self):265 self.init_pawns()266 self.init_rooks()267 self.init_bishops()268 self.init_knights()269 self.init_queens()270 self.init_kings()...
newset.py
Source:newset.py
1archivos = ["en_landing","get_file","format_columns_bcra_deudores","en_landing","insert_hive","get_file","get_file","en_landing","list_dir","en_landing","en_landing","list_dir","insert_hive","list_dir","insert_hive","get_file","insert_hive","insert_hive","en_landing","insert_hive","insert_hive","list_dir","insert_hive","en_landing","list_dir","get_file","insert_sampo","en_landing","get_file","list_dir","sqoop_to_sql","list_dir","insert_hive","xls_to_csv","insert_hive","send_email","list_dir","insert_hive","en_landing","insert_hive","get_file","insert_hive","get_file","list_dir","get_file","insert_hive_multi","en_landing","get_file","insert_hive_multi","insert_hive","insert_hive","get_file","list_dir","list_dir","insert_hive","get_file","list_dir","get_file","en_landing","en_landing","get_file","en_landing","en_landing","insert_hive","insert_hive","en_landing","mail","insert_hive_abm","insert_hive","send_email","insert_hive_multi","list_dir","en_landing","send_email","en_landing","list_dir","list_dir","faster_insert_hive","en_landing","en_landing","get_file","get_file","call_api","list_dir","send_email","en_landing","get_file","sqoop_to_sql","insert_hive","get_file","insert_hive","en_landing","en_landing","list_dir","send_email","insert_hive","insert_sampo","insert_hive","insert_hive","en_landing","list_dir","insert_hive","faster_insert_hive","upload_landing","list_dir","mail","en_landing","enviar_mail","send_email","list_dir","list_dir","list_dir","insert_hive_abm","list_dir","list_dir","send_email","en_landing","insert_hive","en_landing","en_landing","list_dir","list_dir","insert_hive_abm","insert_hive","list_dir","get_file","send_email","list_dir","enviar_mail","faster_insert_hive","en_landing","insert_hive","list_dir","delete_hdfs","list_dir","insert_hive","en_landing","en_landing","en_landing","en_landing","get_file","insert_hive","list_dir","insert_hive","get_file","insert_hive","en_landing","en_landing","get_file","list_dir","insert_hive","insert_hive","en_landing","get_file","en_landing","insert_hive","get_file","insert_hive","fraude_txt_to_csv","upload_nextcloud","list_dir","list_dir","en_landing","en_landing","insert_hive_abm","get_file","en_landing","en_landing","get_file","insert_hive","get_file","get_file","en_landing","send_email","execute_query","en_landing","en_landing","get_file","get_file","get_file","list_dir","en_landing","list_dir","xls_to_csv","en_landing","insert_hive_abm","send_email","insert_hive","en_landing","en_landing","get_file","insert_hive","insert_sampo","en_landing","insert_hive","get_file","insert_hive","en_landing","get_file","insert_hive_multi","insert_hive","xls_to_csv","en_landing","get_file","list_dir","insert_hive","en_landing","insert_hive","en_landing","list_dir","list_dir","list_dir","get_file","en_landing","insert_hive","en_landing","list_dir","insert_hive","insert_hive","list_dir","en_landing","insert_hive","en_landing","list_dir","insert_hive","insert_hive","xls_to_csv","list_dir","list_dir","insert_hive","en_landing","insert_hive","en_landing","insert_hive_abm","insert_hive_abm","insert_hive_abm","faster_insert_hive","send_email","insert_hive","execute_query_v2","list_dir","list_dir","en_landing","en_landing","list_dir","get_file","get_file","en_landing","format_columns_bcra_deudores","insert_link","get_file","get_file","insert_hive","get_file","en_landing","list_dir","get_file","insert_hive","xls_to_csv","en_landing","en_landing","get_file","get_file","get_file","get_file","insert_sampo","en_landing","insert_hive","insert_hive_abm","send_email","insert_hive_infer","en_landing","en_landing","en_landing","insert_hive","insert_hive","insert_hive","list_dir","list_dir","insert_hive_abm","insert_hive","get_file","en_landing","get_file","get_file","get_file","insert_hive_abm","insert_hive","get_file","list_dir","en_landing","get_file","list_dir","en_landing","list_dir","list_dir","list_dir","en_landing","list_dir","insert_hive","insert_hive","en_landing","en_landing","execute_query","en_landing","get_file","en_landing","en_landing","send_email","get_file","insert_hive_abm","insert_hive","insert_hive","get_file","get_file","get_file","get_file","list_dir","insert_hive","en_landing","en_landing","en_landing","list_dir","upload_nextcloud","list_dir","list_dir","list_dir","get_file","list_dir","en_landing","insert_hive","get_file","insert_hive","en_landing","list_dir","get_file","en_landing","get_file","xls_to_csv","list_dir","list_dir","list_dir","list_dir","list_dir","en_landing","get_file","en_landing","get_file","insert_hive","en_landing","list_dir","list_dir","list_dir","insert_hive","list_dir","get_file","insert_hive","insert_link","insert_hive","get_file","insert_hive","xls_to_csv","get_file","en_landing","en_landing","insert_hive","insert_hive","en_landing","execute_query_v2","list_dir","insert_hive","get_file","insert_hive","get_file","list_dir","insert_into_table","en_landing","en_landing","get_file","get_file","insert_hive","insert_hive","get_file","insert_link","insert_hive","insert_hive","enviar_mail","get_file","xls_to_csv","list_dir","get_file","en_landing","list_dir","list_dir","execute_query_v2","list_dir","get_file","xls_to_csv","upload_nextcloud","list_dir","fraude_reintento","get_file","list_dir","insert_hive","list_dir","send_email","en_landing","insert_hive","insert_hive","get_file","upload_landing","get_file","list_dir","get_file","en_landing","get_file","insert_sampo","list_dir","insert_hive_infer","list_dir","en_landing","send_email","en_landing","list_dir","insert_sampo","get_file","insert_hive","list_dir","list_dir","execute_query_v2","en_landing","get_file","get_file","get_file","insert_hive","get_file","en_landing","get_file","get_file","get_file","insert_hive","en_landing","list_dir","insert_hive","get_file","en_landing","list_dir","send_email","en_landing","en_landing","list_dir","insert_hive","en_landing","en_landing","insert_hive","insert_hive","en_landing","insert_hive","insert_hive","get_file","list_dir","list_dir","insert_hive","get_file","get_file","insert_hive_abm","en_landing","list_dir","list_dir","en_landing","insert_hive_abm","en_landing","enviar_mail","list_dir","get_file","list_dir","insert_hive","insert_hive","list_dir","insert_hive","get_file","list_dir","insert_hive","list_dir","get_file","list_dir","insert_hive","send_email","get_file","en_landing","en_landing","insert_hive","en_landing","insert_hive","enviar_mail","get_file","insert_hive","insert_hive","get_file","get_file","insert_hive","en_landing","list_dir","get_file","en_landing","get_file","en_landing","upload_nextcloud","insert_hive","list_dir","get_file","xls_to_csv","list_dir","insert_hive","en_landing","send_email","get_file","list_dir","format_columns_bcra_deudores","send_email","en_landing","list_dir","list_dir","get_file","en_landing","insert_hive","en_landing","en_landing","faster_insert_hive","list_dir","get_file","delete_hdfs","en_landing","get_file","get_file","insert_hive","get_file","list_dir","insert_hive","list_dir","insert_hive","en_landing","get_file","insert_hive","xls_to_csv","list_dir","en_landing","insert_hive","en_landing","get_file","insert_hive","list_dir","en_landing","insert_hive_abm","get_file","en_landing","en_landing","get_file","insert_hive","insert_hive","en_landing","en_landing","list_dir","insert_hive","enviar_mail","insert_into_table","en_landing","en_landing","insert_hive","insert_hive","get_file","en_landing","insert_hive","insert_hive","en_landing","faster_insert_hive","en_landing","insert_hive_infer","en_landing","en_landing","list_dir","insert_hive","get_file","faster_insert_hive","en_landing","get_file","execute_query","get_file","en_landing","send_email","get_file","en_landing","execute_query_v2","en_landing","insert_hive","en_landing","en_landing","get_file","list_dir","list_dir","list_dir","en_landing","validacion_tels","execute_query_v2","en_landing","insert_hive","insert_hive","insert_hive_multi","en_landing","insert_hive","insert_hive","list_dir","get_file","insert_hive","get_file","en_landing","xls_to_csv","insert_hive","insert_hive","insert_hive","insert_hive","insert_hive","insert_hive_bcra","list_dir","validar_mails","get_file","sqoop_to_sql","insert_hive","en_landing","en_landing","en_landing","list_dir","insert_hive","get_file","insert_hive","upload_nextcloud","list_dir","list_dir","en_landing","get_file","en_landing","list_dir","get_file","insert_hive","get_file","chain_groupby","list_dir","en_landing","list_dir","upload_landing","get_file","send_email","insert_hive","insert_hive","list_dir","en_landing","get_file","insert_hive","list_dir","list_dir","insert_hive","en_landing","list_dir","insert_hive","send_email","en_landing","list_dir","insert_hive_co","list_dir","insert_hive","insert_hive","send_email","insert_hive","faster_insert_hive","insert_hive","get_file","xls_to_csv","insert_hive","insert_hive","en_landing","get_file","insert_hive","en_landing","insert_hive","list_dir","get_file","insert_hive","insert_mora_ref","xls_to_csv","insert_link","get_file","list_dir","list_dir","list_dir","insert_hive","en_landing","get_file","insert_hive_abm","en_landing","get_file","get_file","send_email","en_landing","list_dir","en_landing","insert_hive","en_landing","en_landing","en_landing","get_file","en_landing","insert_hive","insert_hive","faster_insert_hive","get_file","get_file","insert_hive","en_landing","insert_hive","en_landing","insert_hive","en_landing","insert_hive_contact","en_landing","en_landing","insert_contact_qualia","list_dir","get_file","insert_hive","get_file","list_dir","faster_insert_hive","get_file","send_email","list_dir","insert_hive_multi","insert_hive","get_file","en_landing","list_dir","insert_hive","get_file","insert_hive","insert_hive","en_landing","insert_hive","get_file","get_file","get_file","list_dir","list_dir","en_landing","get_file","en_landing","list_dir","en_landing","enviar_mail","insert_hive","get_file","list_dir","insert_hive","delete_hdfs","insert_hive","en_landing","list_dir","list_dir","en_landing","get_file","en_landing","send_email","get_file","get_file","list_dir","insert_hive","list_dir","get_file","get_file","get_file","insert_hive_infer","list_dir","list_dir","get_file","en_landing","list_dir","get_file","get_file","list_dir","en_landing","fraude_txt_to_csv","insert_hive","list_dir","insert_hive","listsftp","en_landing","get_file","list_dir","send_email","get_file","list_dir","list_dir","insert_hive","insert_hive_abm","insert_hive_abm","list_dir","insert_into_table","list_dir","en_landing","list_dir","insert_hive","list_dir","insert_hive","insert_hive","en_landing","send_email","list_dir","insert_hive","insert_hive","get_file","insert_hive","get_file","get_file","en_landing","list_dir","insert_hive","en_landing","list_dir","send_email","list_dir","list_dir","list_dir","get_file","insert_hive","get_file","insert_hive","get_file","en_landing","get_file","en_landing","list_dir","en_landing","list_dir","insert_hive","insert_hive","list_dir","insert_hive_abm","insert_hive","get_file","list_dir","insert_hive","en_landing","list_dir","en_landing","insert_hive","get_file","send_email","upload_landing","get_file","insert_hive","list_dir","insert_hive","list_dir","list_dir","list_dir","get_file","list_dir","list_dir","list_dir","get_file","get_file","send_email","list_dir","upload_nextcloud","get_file","list_dir","en_landing","list_dir","send_email","en_landing","insert_hive","en_landing","get_file","list_dir","insert_link","insert_hive","en_landing","en_landing","get_file","list_dir","list_dir","get_file","list_dir","get_file","en_landing","insert_hive","get_file","en_landing","get_file","xls_to_csv","send_email","en_landing","en_landing","en_landing","en_landing","list_dir","get_file","get_file","insert_hive","get_file","get_file","en_landing","insert_hive","en_landing","get_file","get_file","list_dir","list_dir","en_landing","insert_hive","upload_nextcloud","get_file","get_file","get_file","upload_nextcloud","get_file","enviar_mail","send_email","get_file","insert_hive","execute_query","insert_hive","list_dir","insert_hive","insert_hive","get_file","insert_hive","en_landing","list_dir","get_file","insert_hive","get_file","insert_hive_abm","en_landing","get_file","insert_hive","list_dir","insert_into_table","sqoop_to_sql","get_file","insert_hive","list_dir","list_dir","en_landing","list_dir","xls_to_csv","send_email","insert_hive","list_dir","en_landing","insert_hive","upload_nextcloud","execute_query_v2","execute_query_v2","insert_hive","list_dir","send_email","insert_hive","insert_hive","send_email","list_dir","list_dir","list_dir","en_landing","en_landing","insert_hive","en_landing","insert_hive","insert_hive","execute_query","insert_hive","list_dir","get_file","listsftp","insert_hive_infer","list_dir","list_dir","insert_hive_bcra_cur","get_file","list_dir","insert_hive_multi","en_landing","list_dir","send_email","en_landing","insert_hive","insert_hive","en_landing","en_landing","en_landing","insert_hive","list_dir","get_file","insert_hive_abm","list_dir","list_dir","list_dir","send_email"]2newarchivos = set(archivos)...
__init__.py
Source:__init__.py
1import pkg_resources2import os3from .about import __version__ # noqa: F4014def get_file(filename):5 return pkg_resources.resource_filename(__name__, os.path.join("data", filename))6mk = {7 "lemma_lookup": get_file("mk_lemma_lookup.json"),8 "lemma_rules": get_file("mk_lemma_rules.json"),9 "lemma_index": get_file("mk_lemma_index.json"),10 "lemma_exc": get_file("mk_lemma_exc.json"),11 "lexeme_norm": get_file("mk_lexeme_norm.json"),12}13hr = {"lemma_lookup": get_file("hr_lemma_lookup.json")}14pt = {15 "lemma_lookup": get_file("pt_lemma_lookup.json"),16 "lexeme_norm": get_file("pt_lexeme_norm.json"),17}18sv = {19 "lemma_lookup": get_file("sv_lemma_lookup.json"),20 "lemma_rules": get_file("sv_lemma_rules.json"),21}22da = {23 "lemma_lookup": get_file("da_lemma_lookup.json"),24 "lexeme_norm": get_file("da_lexeme_norm.json"),25}26ca = {27 "lemma_lookup": get_file("ca_lemma_lookup.json"),28 "lemma_exc": get_file("ca_lemma_exc.json"),29 "lemma_index": get_file("ca_lemma_index.json"),30 "lemma_rules": get_file("ca_lemma_rules.json"),31}32es = {33 "lemma_lookup": get_file("es_lemma_lookup.json"),34 "lemma_exc": get_file("es_lemma_exc.json"),35 "lemma_index": get_file("es_lemma_index.json"),36 "lemma_rules": get_file("es_lemma_rules.json"),37 "lemma_rules_groups": get_file("es_lemma_rules_groups.json"),38 "lexeme_cluster": get_file("es_lexeme_cluster.json"),39 "lexeme_prob": get_file("es_lexeme_prob.json"),40 "lexeme_settings": get_file("es_lexeme_settings.json"),41}42fr = {43 "lemma_rules": get_file("fr_lemma_rules.json"),44 "lemma_index": get_file("fr_lemma_index.json"),45 "lemma_exc": get_file("fr_lemma_exc.json"),46 "lemma_lookup": get_file("fr_lemma_lookup.json"),47}48ga = {49 "lemma_lookup_adj": get_file("ga_lemma_lookup_adj.json"),50 "lemma_lookup_adp": get_file("ga_lemma_lookup_adp.json"),51 "lemma_lookup_noun": get_file("ga_lemma_lookup_noun.json"),52 "lemma_lookup_verb": get_file("ga_lemma_lookup_verb.json"),53}54nb = {55 "lemma_lookup": get_file("nb_lemma_lookup.json"),56 "lemma_exc": get_file("nb_lemma_exc.json"),57 "lemma_rules": get_file("nb_lemma_rules.json"),58}59tr = {"lemma_lookup": get_file("tr_lemma_lookup.json")}60de = {61 "lemma_lookup": get_file("de_lemma_lookup.json"),62 "lexeme_norm": get_file("de_lexeme_norm.json"),63 "lexeme_cluster": get_file("de_lexeme_cluster.json"),64 "lexeme_prob": get_file("de_lexeme_prob.json"),65 "lexeme_settings": get_file("de_lexeme_settings.json"),66 "orth_variants": get_file("de_orth_variants.json"),67}68it = {69 "lemma_lookup": get_file("it_lemma_lookup.json"),70 "lemma_lookup_num": get_file("it_lemma_lookup_num.json"),71 "lemma_lookup_det": get_file("it_lemma_lookup_det.json"),72 "lemma_lookup_adp": get_file("it_lemma_lookup_adp.json"),73 "lemma_lookup_adj": get_file("it_lemma_lookup_adj.json"),74 "lemma_lookup_noun": get_file("it_lemma_lookup_noun.json"),75 "lemma_lookup_pron": get_file("it_lemma_lookup_pron.json"),76 "lemma_lookup_verb": get_file("it_lemma_lookup_verb.json"),77 "lemma_lookup_aux": get_file("it_lemma_lookup_aux.json"),78 "lemma_lookup_adv": get_file("it_lemma_lookup_adv.json"),79 "lemma_lookup_other": get_file("it_lemma_lookup_other.json"),80}81lt = {"lemma_lookup": get_file("lt_lemma_lookup.json")}82nl = {83 "lemma_rules": get_file("nl_lemma_rules.json"),84 "lemma_index": get_file("nl_lemma_index.json"),85 "lemma_exc": get_file("nl_lemma_exc.json"),86 "lemma_lookup": get_file("nl_lemma_lookup.json"),87}88ro = {"lemma_lookup": get_file("ro_lemma_lookup.json")}89sr = {90 "lemma_lookup": get_file("sr_lemma_lookup.json"),91 "lexeme_norm": get_file("sr_lexeme_norm.json"),92}93id_ = {94 "lemma_lookup": get_file("id_lemma_lookup.json"),95 "lexeme_norm": get_file("id_lexeme_norm.json"),96}97hu = {"lemma_lookup": get_file("hu_lemma_lookup.json")}98fa = {99 "lemma_rules": get_file("fa_lemma_rules.json"),100 "lemma_index": get_file("fa_lemma_index.json"),101 "lemma_exc": get_file("fa_lemma_exc.json"),102}103en = {104 "lemma_lookup": get_file("en_lemma_lookup.json"),105 "lemma_rules": get_file("en_lemma_rules.json"),106 "lemma_index": get_file("en_lemma_index.json"),107 "lemma_exc": get_file("en_lemma_exc.json"),108 "lexeme_norm": get_file("en_lexeme_norm.json"),109 "lexeme_cluster": get_file("en_lexeme_cluster.json"),110 "lexeme_prob": get_file("en_lexeme_prob.json"),111 "lexeme_settings": get_file("en_lexeme_settings.json"),112 "orth_variants": get_file("en_orth_variants.json"),113}114el = {115 "lemma_index": get_file("el_lemma_index.json"),116 "lemma_exc": get_file("el_lemma_exc.json"),117 "lemma_rules": get_file("el_lemma_rules.json"),118 "lexeme_norm": get_file("el_lexeme_norm.json"),119 "lexeme_prob": get_file("el_lexeme_prob.json"),120 "lexeme_settings": get_file("el_lexeme_settings.json"),121}122bn = {"lemma_rules": get_file("bn_lemma_rules.json")}123tl = {"lemma_lookup": get_file("tl_lemma_lookup.json")}124ur = {"lemma_lookup": get_file("ur_lemma_lookup.json")}125lb = {126 "lemma_lookup": get_file("lb_lemma_lookup.json"),127 "lexeme_norm": get_file("lb_lexeme_norm.json"),128}129ru = {130 "lexeme_norm": get_file("ru_lexeme_norm.json"),131 "lemma_lookup": get_file("ru_lemma_lookup.json"),132}133ta = {"lexeme_norm": get_file("ta_lexeme_norm.json")}134th = {"lexeme_norm": get_file("th_lexeme_norm.json")}135pl = {136 "lemma_lookup_adj": get_file("pl_lemma_lookup_adj.json"),137 "lemma_lookup_adp": get_file("pl_lemma_lookup_adp.json"),138 "lemma_lookup_adv": get_file("pl_lemma_lookup_adv.json"),139 "lemma_lookup_aux": get_file("pl_lemma_lookup_aux.json"),140 "lemma_lookup_noun": get_file("pl_lemma_lookup_noun.json"),141 "lemma_lookup_num": get_file("pl_lemma_lookup_num.json"),142 "lemma_lookup_part": get_file("pl_lemma_lookup_part.json"),143 "lemma_lookup_pron": get_file("pl_lemma_lookup_pron.json"),144 "lemma_lookup_verb": get_file("pl_lemma_lookup_verb.json"),145}146cs = {147 "lemma_lookup": get_file("cs_lemma_lookup.json"),148 "lexeme_norm": get_file("cs_lexeme_norm.json"),149}150grc = {151 "lemma_lookup": get_file("grc_lemma_lookup.json"),152 "lexeme_norm": get_file("grc_lexeme_norm.json"),...
test_view.py
Source:test_view.py
...15 :return: Response16 """17 here_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))18 fixture_dir = os.path.join(here_dir, '../../fixtures')19 data = dict(file=get_file(f"{fixture_dir}/{filename}"))20 res = client.post(url, data=data, content_type='multipart/form-data')21 assert res.status_code == expected_status_code22 return res23class TestView:24 def test_echo(self, client, get_file):25 """ Test the echo endpoint """26 res = upload("/echo", client, get_file)27 assert res.text == '1,2,3\n4,5,6\n7,8,9'28 def test_invert(self, client, get_file):29 """ Test the invert endpoint """30 res = upload("/invert", client, get_file)31 assert res.text == '1,4,7\n2,5,8\n3,6,9'32 def test_flatten(self, client, get_file):33 """ Test the 'flatten' endpoint"""...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!