How to use get_buff method in avocado

Best Python code snippet using avocado_python

analyzation1.py

Source:analyzation1.py Github

copy

Full Screen

...45 next_state = dict_state.find_state( stat.get_state(), self.define_symb(self.curr_symbs[1]), self.define_symb(self.curr_symbs[0]))46 stat.set_state( next_state )47 lexem_type = stat.get_state()48 next_state = dict_state.find_state( stat.get_state(), self.define_symb(self.curr_symbs[0]), self.define_symb(self.curr_symbs[1]))49 #print('states ', stat.get_state(), '--->' ,next_state, ' ; symbs ', self.curr_symbs[0],"---> ", self.curr_symbs[1], self.curr_l, self.curr_p, buff.get_buff())50 self.state_action(stat.get_state(),buff)51 52 if stat.get_state() == 7:53 #строка, номер символа и текст сообщения об ошибке54 55 if self.curr_symbs[0] == "":56 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " Unexpected end of file"57 raise ValueError(str_err)58 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " Unexpected symbol " + "'"+ self.curr_symbs[0]+"'"59 raise ValueError(str_err)60# ВЫНЕСТИ В ОТДЕЛЬНУЮ ФУНКЦИЮ61 if stat.get_state() == 4 and self.define_symb(self.curr_symbs[0]) == "N" and self.curr_symbs[1] == ".":62 self.get__next()63 if self.define_symb(self.curr_symbs[1]) == "N":64 next_state = 4165 buff.add_buff(self.curr_symbs[0])66 elif self.define_symb(self.curr_symbs[1]) == ".":67 self.init_array = True68 return self.create_lex(buff, 4)69 else:70 next_state = 771 str_err = str(self.curr_l) + ":" + str(self.curr_p+1) + " Expected number or '.'"72 raise ValueError(str_err)73 #buff.add_buff(self.curr_symbs[0])74# --->75 stat.set_state( next_state )76 77 #print(lexem_type, self.curr_symbs[0], self.lexem_pos)78 if stat.get_state() == 1:79 #if lexem_type == 80:80 #buff.clear_buff()81 #self.lexem_pos = -182 if buff.get_buff() != "":83 if lexem_type == 9:84 if buff.get_buff()[0] == buff.get_buff()[-1] == "'":85 return self.create_lex(buff, 5)86 if buff.get_buff()[0] == "{" and buff.get_buff()[-1] == "}":87 return self.create_lex(buff, 81)88 if not buff.get_buff() in self.Delimiters:89 90 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " Wrong delimiter " + "'"+buff.get_buff()+"'"91 raise ValueError(str_err)92 #stat.set_state(7)93 else:94 return self.create_lex(buff, lexem_type)95 else: 96 return self.create_lex(buff, lexem_type)97 if stat.get_state() == 3:98 if buff.get_buff() == "":99 return self.create_lex(buff, 3)100 else:101 return self.create_lex(buff, dict_state.find_state( 1, self.define_symb(self.curr_symbs[0]), self.define_symb(self.curr_symbs[0])))102#103# MAIN104#105 def get_next_symb(self):106 return self.input_file.read(1)107 def get__next(self):108 self.curr_symbs[0] = self.curr_symbs[1]109 self.curr_symbs[1] = self.get_next_symb()110 if self.curr_symbs[0] == '\n':111 self.curr_l += 1112 self.curr_p = -1113 self.curr_p += 1114 115 def state_action(self, stat, buff):116 #if stat != 1 and stat != 81 and stat != 80:117 if stat != 1:118 if self.lexem_pos == -1:119 self.lexem_pos = str(self.curr_l) + ':' + str(self.curr_p)120 buff.add_buff(self.curr_symbs[0])121 if self.init_array:122 buff.add_buff(self.curr_symbs[0])123 self.init_array = False124 125 def define_symb(self,symb):126 if symb == "":127 return symb128 elif symb.isalpha():129 if symb == "e":130 return "E"131 elif symb in ['A','B','C','D','E','F']:132 return "D"133 else:134 return "L"135 elif symb.isdigit():136 return "N"137 elif symb in self.Separators:138 if symb == "\n":139 return "\n"140 return "S"141 elif symb == "+" or symb == "*":142 return "I"143 elif symb == ">" or symb == "<":144 return "W"145 else:146 return symb147 def create_lex(self, buff, state):148 value = buff.get_buff()149 if state == 4:150 type_s = 'int'151 elif state == 5:152 type_s = 'string'153 154 unic = value[1:-1]155 if unic.find("'") != -1:156 unic = unic[unic.find("'")+1:unic.rfind("'")]157 if unic == "#10" or unic == "#13" or unic == "#13#10" :158 value = value.replace(unic, "\n")159 elif unic == "#9":160 value = value.replace(unic, "\t")161 else:162 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " Illegal char constant"163 raise ValueError(str_err)164 value = value.replace("'",'')165 elif state == 6:166 if value in self.Key_words:167 type_s = 'reserved id'168 else:169 type_s = 'id' 170 elif state == 9:171 type_s = 'delimiter'172 elif state == 41:173 correct = re.fullmatch('[-]?(?:\d+\.\d+)(?:[e][-]?\d+)?', value)174 if correct:175 type_s = 'float'176 value = float(buff.get_buff())177 else:178 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " Wrong float format"179 raise ValueError(str_err);180 elif state == 2:181 type_s = 'hex'182 try:183 value = hex(int(value.replace('$',"", 1), 16))184 except Exception as e:185 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " invalid symbol for int with base 16"186 raise ValueError(str_err)187 elif state == 11:188 type_s = 'octal'189 try:190 value = oct(int(value.replace('&',"", 1), 8))191 except Exception as e:192 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " invalid symbol for int with base 8"193 raise ValueError(str_err)194 elif state == 12:195 type_s = 'binary'196 try:197 value = bin(int(value.replace('%',"", 1), 2))198 except Exception as e:199 str_err = str(self.curr_l) + ":" + str(self.curr_p) + " invalid symbol for int with base 2"200 raise ValueError(str_err)201 202 elif state == 3:203 type_s = 'eof'204 elif state == 80 or state == 81:205 self.lexem_pos = -1206 buff.clear_buff()207 return self.analyzer()208 else:209 type_s = state210 new_lex = Lexer(self.lexem_pos, type_s, buff.get_buff(), value)211 self.lexem_pos = -1212 buff.clear_buff()213 return new_lex...

Full Screen

Full Screen

base.py

Source:base.py Github

copy

Full Screen

...11 StaticBuff,12)13class AbstractEngraving(BaseModel):14 name: str15 def get_buff(self, level: int) -> AbstractBuff:16 raise NotImplementedError()17class OnoffEngraving(AbstractEngraving):18 stat_list: List[Stat]19 def get_buff(self, level: int) -> OnoffBuff:20 return OnoffBuff(21 name=self.name,22 stat=self.stat_list[level - 1],23 )24class StaticEngraving(AbstractEngraving):25 stat_list: List[Stat]26 def get_buff(self, level: int) -> StaticBuff:27 return StaticBuff(28 name=self.name,29 stat=self.stat_list[level - 1],30 )31class StackEngraving(AbstractEngraving):32 stat_fn_list: List[Callable[[int], Stat]]33 def get_buff(self, level: int) -> StackBuff:34 return StackBuff(35 name=self.name,36 stat_fn=self.stat_fn_list[level - 1],37 )38class SkillEngraving(AbstractEngraving):39 stat_fn_list: List[Callable[[Skill], Stat]]40 def get_buff(self, level: int) -> SkillBuff:41 return SkillBuff(42 name=self.name,43 stat_fn=self.stat_fn_list[level - 1],44 )45class StatEngraving(AbstractEngraving):46 stat_fn_list: List[Callable[[Stat], Stat]]47 def get_buff(self, level: int) -> StatBuff:48 return StatBuff(49 name=self.name,50 stat_fn=self.stat_fn_list[level - 1],51 )52class EngravingRepository:53 def __init__(self):54 self._engravings: Dict[str, AbstractEngraving] = {}55 def add(self, engraving: AbstractEngraving):56 self._engravings[engraving.name] = engraving57 def get_buffs(self, engraving_status: Dict[str, int]) -> List[AbstractBuff]:58 buffs: List[AbstractBuff] = []59 for name, level in engraving_status.items():60 engraving = self._engravings.get(name)61 if engraving is None:62 raise Exception(f"{name} is not an engraving")63 buffs.append(engraving.get_buff(level))...

Full Screen

Full Screen

Stage2.py

Source:Stage2.py Github

copy

Full Screen

...17 return _("精修")18 if status.currentDurability <= 10:19 return _("精修")20 if status.ball == BallManager.RedBall:21 if status.get_buff(_('内静')).data["lv"] < 10:22 return _("集中加工")23 return _("秘诀")24 elif status.ball == BallManager.YellowBall:25 if 1<status.get_buff(_('内静')).data["lv"] < 7:26 return _('专心加工')27 return _("仓促")28 if status.currentDurability - (status.ball.durability * 10) <= 10:29 return _("精修")30 if 1<status.get_buff(_('内静')).data["lv"] < 6:31 return _('专心加工')32 if not status.has_buff(_('俭约')):33 return _("俭约加工")34 return _("仓促")35 def is_finished(self, status: Status, prev_skill=None):...

Full Screen

Full Screen

testScript.py

Source:testScript.py Github

copy

Full Screen

...12rEvQ1.addHit(1250)13rEvQ2.addHit(830)14rEvQ2.addHit(1060)15rEvQ2.addHit(1250)16print(hQ.get_buff())17hQ.update([rEvQ1])18print(hQ.get_buff())19print(rEvQ1.get_buff())...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful