storyscript/lexer.py
File lexer.py
has 846 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import numpy as np
# I tried to convince DeepSource that all of the objects existed
from .langData import Exceptions, LambdaExpr, BASE_KEYWORDS, PRIMITIVE_TYPE, Types, mismatch_type, LISTDECLARE_KEYW, PythonFunctionObject, invalid_value, Array, not_enough_args_for_import_statement
from typing import NoReturn
from .langParser import Parser
Avoid deeply nested control flow statements. Open
Open
if is_in_else_block:
ifstatement["else"] = commands
else:
ifstatement["if"] = commands
is_in_else_block = False
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return (
Avoid too many return
statements within this function. Open
Open
return self.switch_case_statement(tc)
Avoid too many return
statements within this function. Open
Open
return len(self.symbol_table.GetVariable(functioncall[0])[1].data), None
Avoid too many return
statements within this function. Open
Open
return self.handle_function(functioncall, original_text)
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return self.parse_lambda_expression(tc)
Avoid too many return
statements within this function. Open
Open
return "NotDefinedException: Undefined argument #1 \"msg\" in string.Trim method call.", Exceptions.NotDefinedException
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return f'"{res}"', None # Return the Recieved Input
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return self.loopfor_statement(tc)
Avoid too many return
statements within this function. Open
Open
return f"InvalidIndexException: {ie}", Exceptions.InvalidIndexException
Avoid too many return
statements within this function. Open
Open
return arguments[0][int(arguments[1]):int(arguments[2])], None
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return invalid_value, Exceptions.InvalidValue
Avoid too many return
statements within this function. Open
Open
return "NotDefinedException: value arguments is required but not defined.", Exceptions.NotDefinedException
Avoid too many return
statements within this function. Open
Open
return f"\"{arguments[0]}\"", None
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return f"InvalidTypeException: Invalid type, Expected {name[0].value} for argument #{argpos}, found {valtype.value}.", Exceptions.InvalidTypeException
Avoid too many return
statements within this function. Open
Open
return f"(Python Exception): {e}", "(Python Exception)"
Avoid too many return
statements within this function. Open
Open
return f"InvalidTypeException: Unknown method mapping type. (Error occurred while scanning method \"{i}\")", Exceptions.InvalidTypeException
Avoid too many return
statements within this function. Open
Open
return self.ternary_operator(tc)
Avoid too many return
statements within this function. Open
Open
return f"InvalidTypeException: Expected argument #1 to be Number, Found {type(argument).__name__}", Exceptions.InvalidTypeException
Avoid too many return
statements within this function. Open
Open
return f"\"{msg.strip()}\"", None
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return "null", None
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return mismatch_type, Exceptions.InvalidValue
Avoid too many return
statements within this function. Open
Open
return "InvalidOperatorException: You cannot use += with lambda expression, maybe you are looking for Event?", Exceptions.InvalidOperatorException
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return self.handle_imports(tc)
Avoid too many return
statements within this function. Open
Open
return value, error
Avoid too many return
statements within this function. Open
Open
return self.handle_array_setting_variable_methods(functioncall, function_name)
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return (
Avoid too many return
statements within this function. Open
Open
return "InvalidSyntax: Invalid type", Exceptions.InvalidSyntax
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return "false", None
Avoid too many return
statements within this function. Open
Open
return f"InvalidTypeException: Expected argument #1 to be Number, Found {type(argument).__name__}", Exceptions.InvalidTypeException
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return f"InvalidTypeException: Return value mismatched. Expected {function_object.return_type.value}, found {valtype.value}.", Exceptions.InvalidTypeException
Avoid too many return
statements within this function. Open
Open
return (
Avoid too many return
statements within this function. Open
Open
return f"\"{msg.strip(arguments[1])}\"", None
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return res, error
Avoid too many return
statements within this function. Open
Open
return filepath, error
Avoid too many return
statements within this function. Open
Open
return f"NotDefinedException: File {filepath} is trying to map methods, but no method mapping dictionary is found.", Exceptions.NotDefinedException
Avoid too many return
statements within this function. Open
Open
return "true", None
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return self.handle_new_keyword(tc, original_text)
Avoid too many return
statements within this function. Open
Open
return value, error
Avoid too many return
statements within this function. Open
Open
return self.handle_base_keywords(tc, original_text)
Avoid too many return
statements within this function. Open
Open
return (
Avoid too many return
statements within this function. Open
Open
return None, None
Avoid too many return
statements within this function. Open
Open
return f"EXITREQUEST {value}", None
Avoid too many return
statements within this function. Open
Open
return f"InvalidOperatorException: You cannot use {operator}= with lambda expression.", Exceptions.InvalidOperatorException
Avoid too many return
statements within this function. Open
Open
return "InvalidSyntax: Invalid value", Exceptions.InvalidSyntax
Avoid too many return
statements within this function. Open
Open
return (
Avoid too many return
statements within this function. Open
Open
return result, None
Avoid too many return
statements within this function. Open
Open
return f'"{res.value}"', None
Avoid too many return
statements within this function. Open
Open
return res, None