Best Python code snippet using tempest_python
schemas.py
Source:schemas.py
...32 is_superuser_doc = "æ¯å¦è¶
管"33 is_master_doc = "æ¯å¦ç®¡çå"34 is_active_doc = "æ¯å¦æ¿æ´»"35 is_online_doc = "æ¯å¦å¨çº¿"36 username: str = field(metadata=set_metadata(37 String(120), username_doc, nullable=False))38 password: str = field(metadata=set_metadata(39 String(120), password_doc, nullable=False))40 first_name: str = field(metadata=set_metadata(41 String(120), first_name_doc, nullable=True))42 last_name: str = field(metadata=set_metadata(43 String(120), last_name_doc, nullable=True))44 mobile: str = field(metadata=set_metadata(45 INTEGER, mobile_doc, nullable=True))46 email: str = field(metadata=set_metadata(47 String(120), email_doc, nullable=True))48 gender: int = field(metadata=set_metadata(49 INTEGER, gender_doc,50 default=GenderType.MALE if not get_enum(51 'gender') else get_enum('gender')['male']52 )53 )54 is_active: bool = field(metadata=set_metadata(55 Boolean, is_active_doc, default=True))56 is_online: bool = field(metadata=set_metadata(57 Boolean, is_online_doc, default=False))58 is_superuser = field(metadata=set_metadata(59 Boolean, is_superuser_doc, default=False))60 is_master = field(metadata=set_metadata(61 Boolean, is_master_doc, default=False))62 apps: List[Apps] = field(default_factory=list, metadata=set_metadata(63 "Apps", apps_doc, is_relationship=True, nullable=True))64 modules: List[Modules] = field(default_factory=list, metadata=set_metadata(65 "Modules", modules_doc, is_relationship=True, nullable=True))66 groups: List[Groups] = field(default_factory=list, metadata=set_metadata(67 "Groups", groups_doc, is_relationship=True, nullable=True))68@dataclass69class AppsMixin(BaseMixin):70 name_doc = "åºç¨å称"71 description_doc = "åºç¨æè¿°"72 name: str = field(metadata=set_metadata(73 String(120), name_doc, unique=True))74 description = field(metadata=set_metadata(75 Text(500), description_doc, nullable=True))76@dataclass77class ModulesMixin(BaseMixin):78 name_doc = "模åå称"79 description_doc = "模åæè¿°"80 name: str = field(metadata=set_metadata(81 String(120), name_doc, unique=True))82 description: str = field(metadata=set_metadata(83 Text(500), description_doc, nullable=True))84@dataclass85class GroupsMixin(BaseMixin):86 name_doc = "ç¨æ·ç»å称"87 description_doc = "ç¨æ·ç»æè¿°"88 roles_doc = "è§è²"89 name: str = field(metadata=set_metadata(90 String(120), name_doc, unique=True))91 description: str = field(metadata=set_metadata(92 Text(500), description_doc, nullable=True))93 roles: List[Roles] = field(default_factory=list, metadata=set_metadata(94 "Roles", roles_doc, is_relationship=True, nullable=True))95@dataclass96class RolesMixin(BaseMixin):97 name_doc = "è§è²å称"98 description_doc = "è§è²æè¿°"99 permissions_doc = "æé"100 name: str = field(metadata=set_metadata(101 String(120), name_doc, unique=True))102 description: str = field(metadata=set_metadata(103 Text(500), description_doc, nullable=True))104 permissions: List[Permissions] = field(105 default_factory=list, metadata=set_metadata(106 "Permissions",107 permissions_doc,108 is_relationship=True,109 nullable=True110 )111 )112@dataclass113class PermissionsMixin(BaseMixin):114 name_doc = "æéå称"115 description_doc = "æéæè¿°"116 modules_doc = "æå±æ¨¡å"117 name: str = field(metadata=set_metadata(118 String(120), name_doc, unique=True))119 description: str = field(metadata=set_metadata(120 Text(500), description_doc, nullable=True))121 modules = List[Modules] = field(122 default_factory=list, metadata=set_metadata(123 "Modules", modules_doc, is_relationship=True, nullable=True))124@dataclass125class TagsMixin(BaseMixin):126 name_doc = "æ ç¾å称"127 color_doc = "æ ç¾é¢è²"128 tag_type_doc = "æ ç¾ç±»å"129 description_doc = "æ ç¾æè¿°"130 name: str = field(metadata=set_metadata(131 String(120), name_doc, unique=True))132 color: str = field(metadata=set_metadata(133 String(120), color_doc, default='red', nullable=True))134 tag_type = field(metadata=set_metadata(135 INTEGER, tag_type_doc, default=TagType.OTHER if not get_enum(136 'tag') else get_enum('tag')['other']))137 description: str = field(metadata=set_metadata(...
releasetools.py
Source:releasetools.py
...16 info.script.AppendExtra("ifelse(is_mounted(\"/vendor\"), unmount(\"/vendor\"));")17 info.script.AppendExtra('mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system");');18 info.script.AppendExtra('mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/vendor", "/vendor");');19 info.script.AppendExtra('set_metadata_recursive("/system/app/NfcNci", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);');20 info.script.AppendExtra('set_metadata("/system/etc/libnfc-brcm.conf", "uid", 0, "gid", 0, "mode", 0644);');21 info.script.AppendExtra('set_metadata("/system/etc/libnfc-nci.conf", "uid", 0, "gid", 0, "mode", 0644);');22 info.script.AppendExtra('set_metadata("/system/etc/libnfc-nxp.conf", "uid", 0, "gid", 0, "mode", 0644);');23 info.script.AppendExtra('set_metadata("/system/etc/permissions/android.hardware.nfc.hce.xml", "uid", 0, "gid", 0, "mode", 0644);');24 info.script.AppendExtra('set_metadata("/system/etc/permissions/android.hardware.nfc.hcef.xml", "uid", 0, "gid", 0, "mode", 0644);');25 info.script.AppendExtra('set_metadata("/system/etc/permissions/android.hardware.nfc.xml", "uid", 0, "gid", 0, "mode", 0644);');26 info.script.AppendExtra('set_metadata("/system/etc/permissions/com.android.nfc_extras.xml", "uid", 0, "gid", 0, "mode", 0644);');27 info.script.AppendExtra('set_metadata("/system/framework/com.android.nfc_extras.jar", "uid", 0, "gid", 0, "mode", 0644);');28 info.script.AppendExtra('set_metadata("/system/lib/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');29 info.script.AppendExtra('set_metadata("/system/lib/libnfc_ndef.so", "uid", 0, "gid", 0, "mode", 0644);');30 info.script.AppendExtra('set_metadata("/system/lib/vndk-26/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');31 info.script.AppendExtra('set_metadata("/system/lib/vndk-27/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');32 info.script.AppendExtra('set_metadata("/system/lib/vndk-28/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');33 info.script.AppendExtra('set_metadata("/system/lib/vndk-28/android.hardware.nfc@1.1.so", "uid", 0, "gid", 0, "mode", 0644);');34 info.script.AppendExtra('set_metadata("/system/lib64/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');35 info.script.AppendExtra('set_metadata("/system/lib64/android.hardware.nfc@1.1.so", "uid", 0, "gid", 0, "mode", 0644);');36 info.script.AppendExtra('set_metadata("/system/lib64/libnfc-nci.so", "uid", 0, "gid", 0, "mode", 0644);');37 info.script.AppendExtra('set_metadata("/system/lib64/libnfc_nci_jni.so", "uid", 0, "gid", 0, "mode", 0644);');38 info.script.AppendExtra('set_metadata("/system/lib64/libnfc_ndef.so", "uid", 0, "gid", 0, "mode", 0644);');39 info.script.AppendExtra('set_metadata("/system/lib64/vndk-26/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');40 info.script.AppendExtra('set_metadata("/system/lib64/vndk-27/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');41 info.script.AppendExtra('set_metadata("/system/lib64/vndk-28/android.hardware.nfc@1.0.so", "uid", 0, "gid", 0, "mode", 0644);');42 info.script.AppendExtra('set_metadata("/system/lib64/vndk-28/android.hardware.nfc@1.1.so", "uid", 0, "gid", 0, "mode", 0644);');43 info.script.AppendExtra('assert(run_program("/sbin/sh", "/tmp/install/bin/releasetools.hi6250.sh") == 0);')44 info.script.AppendExtra('unmount("/system");');45 info.script.AppendExtra('unmount("/vendor");');46def FullOTA_PostValidate(info):47 info.script.AppendExtra('run_program("/sbin/e2fsck", "-fy", "/dev/block/bootdevice/by-name/system");');48 info.script.AppendExtra('run_program("/tmp/install/bin/resize2fs_static", "/dev/block/bootdevice/by-name/system");');...
__init__.py
Source:__init__.py
2from django.utils.translation import ugettext as _3from djangoplus.utils.metadata import set_metadata, iterable4def meta(verbose_name, help_text=None, formatter=None, dashboard=None, shortcut=False, can_view=(), expose=True, icon=None):5 def decorate(func):6 set_metadata(func, 'type', 'attr')7 set_metadata(func, 'verbose_name', verbose_name)8 set_metadata(func, 'can_view', can_view)9 set_metadata(func, 'help_text', help_text)10 set_metadata(func, 'formatter', formatter)11 set_metadata(func, 'dashboard', dashboard)12 set_metadata(func, 'shortcut', shortcut)13 set_metadata(func, 'icon', icon)14 set_metadata(func, 'expose', iterable(expose))15 return func16 return decorate17def subset(verbose_name, help_text=None, list_display=(), list_filter=None, search_fields=None, template=None, menu=None,18 dashboard=None, usecase=None, can_view=(), can_alert=(), can_notify=(), expose=True):19 def decorate(func):20 from djangoplus import next_number21 set_metadata(func, 'type', 'subset')22 set_metadata(func, 'tab', True)23 set_metadata(func, 'verbose_name', verbose_name)24 set_metadata(func, 'alert', can_alert)25 set_metadata(func, 'notify', can_notify)26 set_metadata(func, 'menu', menu)27 set_metadata(func, 'help_text', help_text)28 set_metadata(func, 'usecase', usecase)29 set_metadata(func, 'can_view', iterable(can_view))30 set_metadata(func, 'name', func.__name__)31 set_metadata(func, 'order', next_number())32 set_metadata(func, 'dashboard', dashboard)33 set_metadata(func, 'list_display', list_display)34 set_metadata(func, 'list_filter', list_filter)35 set_metadata(func, 'search_fields', search_fields)36 set_metadata(func, 'template', template)37 set_metadata(func, 'formatter', None)38 set_metadata(func, 'expose', iterable(expose))39 return func40 return decorate41def action(verbose_name, help_text=None, condition=None, inline=False, subset=(), icon=None, category=None,42 style='popup', message=_('Action successfully performed.'), redirect_to=None, menu=None, initial=None,43 choices=None, display=None, input=None, usecase=None, can_execute=(), can_execute_by_organization=None,44 can_execute_by_unit=None, can_execute_by_role=None, expose=True):45 def decorate(func):46 func._action = dict(47 verbose_name=verbose_name, can_execute=iterable(can_execute), help_text=help_text,48 input=input, group=category or verbose_name, style=style, condition=condition, view_name=func.__name__,49 message=message, initial=initial or '{}_initial'.format(func.__name__), function=func,50 choices=choices or '{}_choices'.format(func.__name__), inline=inline, subsets=iterable(subset), icon=icon,51 doc=func.__doc__, usecase=usecase, can_execute_by_organization=iterable(can_execute_by_organization),52 can_execute_by_unit=iterable(can_execute_by_unit), can_execute_by_role=iterable(can_execute_by_role),...
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!!