Best Python code snippet using localstack_python
models.py
Source: models.py
1#!/usr/bin/env python2from django.db import models3import json4def is_none_or_empty(str):5 """6 Checks if a string is None or empty string.7 """8 return not str9class Config(models.Model):10 # Social widgets11 instagram_widget_url = models.TextField()12 twitter_widget_id = models.TextField()13 # Calendar14 gcal_api_key = models.TextField(null=True, blank=True)15 gcal_dnollk_calendar_id = models.TextField(null=True, blank=True)16 gcal_dnollk_calendar_url = models.TextField(null=True, blank=True)17 gcal_timeedit_calendar_id = models.TextField(null=True, blank=True)18 gcal_asp_calendar_id = models.TextField(null=True, blank=True)19 # Form20 gform_link = models.TextField(null=True, blank=True)21 gform_embed_link = models.TextField(null=True, blank=True)22 enable_form = models.BooleanField()23 # Logos and headers24 logo_url = models.TextField(default="/static/dnollkse/images/logo.png")25 header_url = models.TextField(default="/static/dnollkse/images/header.jpg")26 favicon_url = models.TextField(null=True, blank=True)27 year = models.CharField(max_length=4, default="2017")28 def is_dnollk_calendar_enabled(self):29 """30 Returns whether the dnollk calendar is enabled31 """32 return not is_none_or_empty(self.gcal_api_key) \33 and not is_none_or_empty(self.gcal_dnollk_calendar_id) \34 and not is_none_or_empty(self.gcal_dnollk_calendar_url)35 def is_timeedit_calendar_enabled(self):36 """37 Returns whether the timeedit (school) calendar is enabled38 """39 return not is_none_or_empty(self.gcal_api_key) \40 and not is_none_or_empty(self.gcal_timeedit_calendar_id)41 def is_asp_calendar_enabled(self):42 """43 Returns whether the asp calendar is enabled44 """45 return not is_none_or_empty(self.gcal_api_key) \46 and not is_none_or_empty(self.gcal_asp_calendar_id)47 def calEventSources(self):48 """49 Returns a python object with the event sources used in FullCalender.50 """51 eventSources = []52 if self.is_dnollk_calendar_enabled:53 eventSources.append({54 'googleCalendarId': self.gcal_dnollk_calendar_id,55 'className': 'eventCalendar',56 'color': "#FA6607"57 })58 if self.is_timeedit_calendar_enabled:59 eventSources.append({60 'googleCalendarId': self.gcal_timeedit_calendar_id,...
Validator.py
Source: Validator.py
2class Validator:3 @staticmethod4 def validate_signup(username: str, password: str):5 errors = []6 if is_none_or_empty(username):7 errors.append("username cannot be blank")8 if is_none_or_empty(password):9 errors.append("password cannot be blank")10 if len(errors):11 raise ValidationException(errors)12 @staticmethod13 def validate_login(username: str, password: str):14 errors = []15 if is_none_or_empty(username):16 errors.append("username cannot be blank")17 if is_none_or_empty(password):18 errors.append("password cannot be blank")19 if len(errors):20 raise ValidationException(errors)21def is_none_or_empty(var) -> bool:...
model_emailmessage.py
Source: model_emailmessage.py
...9 __table__ = Table('McEmailMessage', Model.metadata,10 autoload=True,11 autoload_with=Model.engine)12 @staticmethod13 def is_none_or_empty(s):14 return (s is not None) and (len(s) > 0)15 @querable16 def is_read(self):17 return self.IsRead18 @querable19 def has_to_addresses(self):20 return McEmailMessage.is_none_or_empty(self.To)21 @querable22 def has_cc_addresses(self):23 return McEmailMessage.is_none_or_empty(self.Cc)24 @querable25 def has_subject(self):...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!