:return: The 'opcode' if this is a turbowarp block: e.g. - log - breakpoint - error - warn - is compiled? - is turbowarp? - is forkphorus? If it's not one, just returns None
(self)
| 348 | |
| 349 | @property |
| 350 | def turbowarp_block_opcode(self): # noqa: C901 |
| 351 | """ |
| 352 | :return: The 'opcode' if this is a turbowarp block: e.g. |
| 353 | - log |
| 354 | - breakpoint |
| 355 | - error |
| 356 | - warn |
| 357 | - is compiled? |
| 358 | - is turbowarp? |
| 359 | - is forkphorus? |
| 360 | If it's not one, just returns None |
| 361 | """ |
| 362 | if self.opcode == "procedures_call": |
| 363 | if self.mutation: |
| 364 | if self.mutation.proc_code: |
| 365 | # \u200B is a zero-width space |
| 366 | if self.mutation.proc_code == "\u200b\u200bbreakpoint\u200b\u200b": |
| 367 | return "breakpoint" |
| 368 | elif self.mutation.proc_code == "\u200b\u200blog\u200b\u200b %s": |
| 369 | return "log" |
| 370 | elif self.mutation.proc_code == "\u200b\u200berror\u200b\u200b %s": |
| 371 | return "error" |
| 372 | elif self.mutation.proc_code == "\u200b\u200bwarn\u200b\u200b %s": |
| 373 | return "warn" |
| 374 | |
| 375 | elif self.opcode == "argument_reporter_boolean": |
| 376 | arg = self.fields.get("VALUE") |
| 377 | |
| 378 | if arg is not None: |
| 379 | arg = arg.value |
| 380 | if isinstance(arg, str): |
| 381 | arg = arg.lower() |
| 382 | |
| 383 | if arg == "is turbowarp?": |
| 384 | return "is_turbowarp?" |
| 385 | |
| 386 | elif arg == "is compiled?": |
| 387 | return "is_compiled?" |
| 388 | |
| 389 | elif arg == "is forkphorus?": |
| 390 | return "is_forkphorus?" |
| 391 | |
| 392 | return None |
| 393 | |
| 394 | @property |
| 395 | def is_turbowarp_block(self): |