You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TinyDB is a very interesting project. The project is well done. Upon reviewing the mypy_plugin.py file, it has a Pylint rating of 2.00/10, indicating multiple areas for improvement. This is just to be more formal with the evaluation. I made a few analyses, and just as a minor improvement, I could suggest, in the hook function inside get_dynamic_class_hook contains type-checking logic that could be error-prone and difficult to maintain. My suggestion is Refactor hook as a separate method, which can make the main logic clearer and easier to debug. For example:
def_hook_logic(ctx: DynamicClassDefContext):
klass=ctx.call.args[0]
ifnotisinstance(klass, NameExpr):
raiseTypeError("Expected a NameExpr instance.")
type_name=klass.fullnameiftype_nameisNone:
raiseValueError("Type name cannot be None.")
qualified=self.lookup_fully_qualified(type_name)
ifqualifiedisNone:
raiseLookupError(f"Failed to find a fully qualified name for {type_name}")
ctx.api.add_symbol_table_node(ctx.name, qualified)
defget_dynamic_class_hook(self, fullname: str) ->CB[DynamicClassDef]:
iffullname=='tinydb.utils.with_typehint':
returnself._hook_logicreturnNone
And thanks for the awesome project!
The text was updated successfully, but these errors were encountered:
Hello, Markus Siemens & TinyDB team!
The TinyDB is a very interesting project. The project is well done. Upon reviewing the
mypy_plugin.py
file, it has a Pylint rating of 2.00/10, indicating multiple areas for improvement. This is just to be more formal with the evaluation. I made a few analyses, and just as a minor improvement, I could suggest, in thehook
function insideget_dynamic_class_hook
contains type-checking logic that could be error-prone and difficult to maintain. My suggestion is Refactorhook
as a separate method, which can make the main logic clearer and easier to debug. For example:The text was updated successfully, but these errors were encountered: