Best Python code snippet using tempest_python
update_cluster_parameters.py
Source:update_cluster_parameters.py
...262 :type: list[ClusterTag]263 """264 self._cluster_tags = cluster_tags265 @property266 def delete_all_tags(self):267 """Gets the delete_all_tags of this UpdateClusterParameters. # noqa: E501268 :return: The delete_all_tags of this UpdateClusterParameters. # noqa: E501269 :rtype: bool270 """271 return self._delete_all_tags272 @delete_all_tags.setter273 def delete_all_tags(self, delete_all_tags):274 """Sets the delete_all_tags of this UpdateClusterParameters.275 :param delete_all_tags: The delete_all_tags of this UpdateClusterParameters. # noqa: E501276 :type: bool277 """278 self._delete_all_tags = delete_all_tags279 def to_dict(self):280 """Returns the model properties as a dict"""281 result = {}282 for attr, _ in six.iteritems(self.swagger_types):283 value = getattr(self, attr)284 if isinstance(value, list):285 result[attr] = list(map(286 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,287 value...
main.py
Source:main.py
1import telebot2import random3import logging4from constants import *5from config import Config6from markup import Markup7from external_api import get_quote_json, get_horoscope8import re9config = Config()10menu = Markup()11bot = telebot.TeleBot(Config.token)12state = {13 "horoscope_period": 'today'14}15@bot.message_handler(commands=["start"])16def start(message):17 bot.send_message(message.chat.id, "Чего Ñебе?", reply_markup=menu.initial_markup())18@bot.message_handler(content_types=["text"])19def handle_text(message):20 markup = None21 # вÑ
од в Ð¼ÐµÐ½Ñ Ð³Ð¾ÑоÑкопов(вÑÐ±Ð¾Ñ Ð¿ÐµÑиода)22 if message.text == HOROSCOPE_MENU_BUTTON:23 text = random.choice(NAVIGATION_MESSAGE_LIST)24 markup = menu.horoscope_menu_markup()25 # вÑ
од в Ð¼ÐµÐ½Ñ Ð³Ð¾ÑоÑкопов(вÑÐ±Ð¾Ñ Ð·Ð½Ð°ÐºÐ°)26 elif message.text in HOROSCOPE_PERIOD_LIST.keys():27 text = random.choice(NAVIGATION_MESSAGE_LIST)28 markup = menu.horoscope_signs_markup()29 state.update({"horoscope_period": HOROSCOPE_PERIOD_LIST.get(message.text)})30 # вÑ
од в Ð¼ÐµÐ½Ñ Ð¾ÑвеÑов на вопÑоÑÑ31 elif message.text == RANDOM_CHOICE_MENU_BUTTON:32 text = '*ÐадÑмай Ñвой вопÑÐ¾Ñ Ð¸ кÑÑÑани ÑаÑ*\nÐÑвеÑÑ: "Ðа", "ÐеÑ" и вÑе, ÑÑо Ð¼ÐµÐ¶Ð´Ñ Ð½Ð¸Ð¼Ð¸'33 markup = menu.random_choice_markup()34 # вÑ
од в главное менÑ(кноÑка назад)35 elif message.text == INITIAL_MENU:36 text = random.choice(NAVIGATION_MESSAGE_LIST)37 markup = menu.initial_markup()38 # кÑÑÑанÑÑÑ ÑаÑ39 elif message.text == RANDOM_CHOICE_BUTTON:40 text = random.choice(RANDOM_CHOICE_MESSAGE_LIST)41 # полÑÑиÑÑ ÑиÑаÑÑ42 elif message.text in QUOTES_BUTTON_LIST:43 text = get_quote_json()44 markup = menu.initial_markup()45 # полÑÑиÑÑ Ð³Ð¾ÑоÑкоп46 elif message.text in HOROSCOPE_BUTTON_LIST.keys():47 horoscope_sign = HOROSCOPE_BUTTON_LIST.get(message.text)48 horoscope_period = state.get("horoscope_period")49 text = get_horoscope(horoscope_sign, horoscope_period)50 # оÑÑалÑное51 else:52 text = "Ðми на кнопки, а не ÑаÑÑÐºÐ°Ð·Ñ Ð¼Ð½Ðµ пиÑи"53 bot.send_message(54 chat_id=message.chat.id,55 text=clean_html(text),56 reply_markup=markup,57 parse_mode="MARKDOWN"58 )59 logging.info(60 f"user: {message.from_user.first_name} {message.from_user.last_name}. message: {message.text}"61 )62def clean_html(text):63 replace_closed_tags = re.compile('</.*?>')64 delete_all_tags = re.compile('<.*?>')65 text = re.sub (replace_closed_tags, '\n', text)66 return re.sub(delete_all_tags, '', text)...
mixins.py
Source:mixins.py
...11 return [i.tag for i in self._get_tags_links()]12 def add_tags(self, tags):13 """Just adding new tags"""14 Tag.add_new_tags(tags, self)15 def delete_all_tags(self):16 old_tags_links = _get_tags_links()17 old_tags.links.delete()18 def replace_tags(self, tags):19 """Removing all tag links from the object and creating new one"""20 21 # Removing links to old tags22 self.delete_all_tags()23 # Adding new...
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!!