def __check_variable(self, variable): if not variable.isalpha() or len(variable) > 1: print_error("Variable must be a letter") if len(self._sides_variable_letters) == 0: self._sides_variable_letters.append(variable) if variable != self._sides_variable_letters[0]: print_error("Variables must contain the same letters")
def __check_coefficient(self, member_coefficient): if member_coefficient == '': return '1' has_division = re.search(r'(\d+)/(\d+)', member_coefficient) if has_division: member_coefficient = str(float(has_division.groups()[0]) / float(has_division.groups()[1])) try: float(member_coefficient) except ValueError: print_error("Coefficient isn't a number") return member_coefficient
def parse(self): if '=' not in self.polynomial_str: print_error("Symbol = isn't found in polynomial") try: left_side, right_side = self.polynomial_str.split('=') except ValueError: print_error("Must be only one sign =") left_side = re.sub(r'\s+', '', left_side) right_side = re.sub(r'\s+', '', right_side) if self.is_verbose: print("Splitting input at left and right side with replacing spacing chars") print("\tLeft side: {}; Right side: {}".format(left_side, right_side)) self.__parse_side(left_side, False) self.__parse_side(right_side, True) self.__sort_parsed_polynomial() if self.is_verbose: print("Filled polynomial dictionary (index - degree, value - coefficient)") print('\t', self._parsed_polynomial, sep='')
Fox().stop, WebDriverException) def login(): Fox().browser.find_element(By.NAME, 'username').send_keys( get_env('STEAM_USERNAME')) Fox().browser.find_element(By.NAME, 'password').send_keys( get_env('STEAM_PASSWORD')) Fox().browser.find_element(By.ID, 'imageLogin').click() Fox().browser.delete_all_cookies() Fox().browser.get('http://csgo.steamanalyst.com/?login') Fox.wait_for_redirect('steamcommunity.com', 2) login() Fox.wait_for_redirect('steamanalyst.com', 2) Fox.wait_for_element(By.ID, 'avatarL') user_agent = Fox().browser.execute_script("return navigator.userAgent;") print json.dumps({ "cookies": Fox().browser.get_cookies(), "userAgent": user_agent }) if __name__ == '__main__': try: main() except (KeyboardInterrupt, SystemExit): Fox.stop() except WebDriverException as e: print_error(e.msg) Fox().stop()
def __check_degree(self, member_degree): if not (member_degree.isnumeric() and int(member_degree) >= 0): print_error("Degree must be integer equal or greater 0")