Best Python code snippet using lisa_python
basic.py
Source:basic.py
...57 return True58@dataclass59class SignedIntegerType(IntegerType):60 name : str = 'signed_int_t'61 def __post_init__(self):62 super().__post_init__()63 self.signed = True64@dataclass65class Unsigned16(IntegerType):66 name : str = 'unsigned_16_t'67 def __post_init__(self):68 super().__post_init__()69 self.bits = 1670@dataclass71class Signed16(SignedIntegerType):72 name : str = 'signed_16_t'73 def __post_init__(self):74 super().__post_init__()75 self.bits = 1676@dataclass77class Unsigned32(IntegerType):78 name : str = 'unsigned_32_t'79 def __post_init__(self):80 super().__post_init__()81 self.bits = 3282@dataclass83class Signed32(SignedIntegerType):84 name : str = 'signed_32_t'85 def __post_init__(self):86 super().__post_init__()87 self.bits = 3288@dataclass89class Unsigned64(IntegerType):90 name : str = 'unsigned_64_t'91 def __post_init__(self):92 super().__post_init__()93 self.bits = 6494@dataclass95class Signed64(SignedIntegerType):96 name : str = 'signed_64_t'97 def __post_init__(self):98 super().__post_init__()99 self.bits = 64100@dataclass101class Identifier32(Unsigned32):102 name : str = 'identifier_32_t'103 def __post_init__(self):104 super().__post_init__()105 self.bits = 32106@dataclass107class Identifier16(IntegerType):108 name : str = 'identifier_16_t'109 def __post_init__(self):110 super().__post_init__()111 self.bits = 16112 self.reserved_bits = 16113@dataclass114class FixedPointType(IntegerType):115 """116 Fixed-Point Integer Type117 """118 radix : int = 0119 resolution : int = 0120 @property121 def is_fixed_point(self):122 return True123 @property124 def range(self):125 scale = 1 << self.radix126 minval, maxval = super().range127 return (minval / scale, maxval / scale)128@dataclass129class EnumType(Field):130 type_ : IntEnum = field(default_factory=IntEnum)131 value : int = None132 def __post_init__(self):133 super().__post_init__()134 self.bits = self.type_.bits135 if not self.value:136 self.value = self.type_()137 else:138 self.value = self.type_(self.value)139 @property140 def is_enum(self):141 return True142@dataclass143class CIFEnableType(Field):144 type_ : Field = None145 indicator_only : bool = False146@dataclass147class EnableIndicatorType(BooleanType):148 bits : int = 2149 is_enable : bool = False150@dataclass151class ListType(Field):152 type_ : Field = None153 linked_size : Field = None154 def __post_init__(self):155 super().__post_init__()156 self.values = []157 @property158 def is_list(self):...
inputs.py
Source:inputs.py
...9 defaults: str = ""10 classes: str = ""11 onchange: str = ""12 value: str = ""13 def __post_init__(self):14 self.name_single = self.prefix + "+" + self.db_key15 self.multi_all = self.prefix + "-" + self.db_key + "-all"16 self.multi_template = self.prefix + "+0+" +self.db_key17 def replace_id_in_template_name(self, sample_id: int=0) -> None:18 self.multi_template = \19 self.multi_template.replace("+0+", "+"+str(sample_id)+"+")20@dataclass21class InputText(_InputBase):22 maxlength: int = None23 def __post_init__(self):24 super().__post_init__()25 self.maxlength = 0 if self.maxlength is None else self.maxlength26@dataclass27class InputNumber(_InputBase):28 min_val: float = None29 max_val: float = None30 step: float = None31 def __post_init__(self):32 super().__post_init__()33 self.min_val = "" if self.min_val is None else float(self.min_val)34 self.max_val = "" if self.max_val is None else float(self.max_val)35 self.step = 1 if self.step is None else float(self.step)36@dataclass37class InputDate(_InputBase):38 min_date: "date" = None39 max_date: "date" = None40 def __post_init__(self):41 super().__post_init__()42 self.min_date = "" if self.min_date is None \43 else self.min_date.strftime("%Y-%m-%d")44 self.max_date = "" if self.max_date is None \45 else self.max_date.strftime("%Y-%m-%d")46@dataclass47class InputSeqFile(_InputBase):48 def __post_init__(self):49 super().__post_init__()50 self.file_type = self.db_key51@dataclass52class InputSeqFileAssembly(_InputBase):53 def __post_init__(self):54 super().__post_init__()55 self.file_type = self.db_key56@dataclass57class InputSelect(_InputBase):58 value: int = 059@dataclass60class InputRadio(_InputBase):...
wrongDunderPostInitSignatureInStdHierarchy.py
Source:wrongDunderPostInitSignatureInStdHierarchy.py
2@dataclasses.dataclass3class A1:4 a: int5 b: dataclasses.InitVar[str]6 def __post_init__(self, b: str):7 print(f"b: {b}")8@dataclasses.dataclass9class B1(A1):10 c: dataclasses.InitVar[int]11 def __post_init__(self, b: str, c: int):12 super(B1, self).__post_init__(b)13 print(f"c: {c}")14@dataclasses.dataclass15class B2(A1):16 c: dataclasses.InitVar[int]17 def __post_init__<error descr="'__post_init__' should take all init-only variables (incl. inherited) in the same order as they are defined">(self, c: int)</error>:...
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!!