Skip to content
Snippets Groups Projects
  1. Nov 24, 2021
  2. Nov 25, 2021
  3. Nov 24, 2021
  4. Nov 23, 2021
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      [mypy] Type RQLHelper's schema attribute as ISchema · bd85b7006744
      Nsukami Patrick authored
      There was an unused protocol definition sleeping within the rql/interfaces.py module.
      This protocol (ISchema) perfectly represent what a schema should be.
      Let's use it to annotate the schema attribute within the RQLHelper class
      bd85b7006744
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      [mypy]: Add type hints for EtypeResolver class: · af2d5233a53f
      Nsukami Patrick authored
      Within rql/analyze.py:
      ----------------------
        add (line 403):
            if self.uid_func:
        and fix:
            error: "None" not callable  [misc]
      
        add (line 548):
            assert self.uid_func_mapping is not None
        and fix:
            Unsupported right operand type for in ("Optional[Dict[Any, Any]]")
      
        change (line 615):
            etypes = frozenset(t for t in self._nonfinal_domain if t not in etypes)
        to:
            etypes = set(t for t in self._nonfinal_domain if t not in etypes)
        and fix:
            Incompatible types in assignment (expression has type "FrozenSet[str]", variable has type "Set[Any]")
      
      
      Within rql/interfaces.py:
      -------------------------
      
      Update ISchema protocol definition:
          add:
              def __contains__():
          and fix:
               error: Unsupported right operand type for in ("ISchema")  [operator]
      
          add:
              def rschema(self, rtype: Any):
          and fix:
              "ISchema" has no attribute "rschema"  [attr-defined]
      
          add:
              def eschema(self, etype: Any):
          and fix:
              "ISchema" has no attribute "eschema"  [attr-defined]
      
      
      See RQL's issue: #15
      af2d5233a53f
  5. Aug 17, 2021
  6. Oct 19, 2021
  7. Oct 18, 2021
  8. Oct 09, 2021
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      Fix Argument 1 to "__call__" of "TranslationFunction" has incompatible type · c03be5e0a47c
      Nsukami Patrick authored
      There is some cases where the `get_description` method will return None.
      The TranslationFunction assume the first parameter will be a string, not None.
      
      Alternative solutions:
      - update the condition: vtype is not None and != "Any" (picked solution)
      - assert returned value is not None whenever necessary
      - update TranslationFunction signature to take first parameter as Optional[str].
      - update all the `get_description` methods to always return a str.
      c03be5e0a47c
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      refactor(mypy): Improve type hints inside OperatorExpressionMixin class · 947a89a37413
      Nsukami Patrick authored
      - define necessary attributes within a protocol
      - this protocol should have:
         - operator attribute
         - iget_nodes method
         - get_type method
      - use the newly defined protocol to type `self` within OperatorExpressionMixin class
      - remove useless type-ignore comments
      947a89a37413
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      refactor(mypy): Improve HSMixin type hints · 97efc3ea82ca
      Nsukami Patrick authored
      Inside rqltypes module
      - define a protocol to describe an object that:
        - has an attribute named `parent`
        - parent attribute should have an attribute named `relation`
        - a method named `get_type`
      
      Inside HSMixin:
      - remove now useless type:ignore comments
      - type `self` as a `HasHand` type
      
      Inside nodes.Constant `get_type` method could return a str or None:
      - make sure `get_type` always returns a str
      - change the default value of `_uidtype` from None to empty string
      - type `_uidtype` as a str
      97efc3ea82ca
  9. Oct 11, 2021
  10. Oct 05, 2021
  11. Oct 03, 2021
  12. Aug 03, 2021
  13. Jul 13, 2021
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      refactor(mypy): Add more type-hints to stmts module · 2873da817f33
      Nsukami Patrick authored
      Inside stmts module,
      somewhere we read, `self.groupby` attribute being added if not exists and used as a list:
      ```
      if not self.groupby:
          self.groupby = []
      ```
      
      Let's just define:
      - self.groupby self.orderby as instance attribute
      - self.groupby self.orderby as List of Any
      - remove the if not self.grouby check
      
      Do the same with the `self.orderby` attribute.
      
      Inside Select class:
      - update `remove` method signature. And fix the error:
        rql/stmts.py:940: error:
        Argument 1 to "remove_sort_term" of "Select" has incompatible type "BaseNode";
        expected "SortTerm"  [arg-type]
      
      - update undefine_variable method:
        remove useless check of var.variable attribute
      
      Inside undo.NodeOperation class:
      - simplify type hint for `node` parameter inside `NodeOperation.__init__` method
      2873da817f33
  14. Aug 04, 2021
    • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
      refactor(mypy): Finish type hint the rql/__init__.py module · c5fb30b4a17b
      Nsukami Patrick authored
      - Type hint all `parse` functions inside rql/__init__.py
      - Create a type alias to represent what's returned by `parse` functions above
      - Update RQLSTChecker.check method signature:
        * node parameter should be a BaseNode	or any children	of BaseNode class
      - Type hint `copy_uid_node` function
      - Remove useless variable: pyparse = parse
      - Format without any compromise
      c5fb30b4a17b
  15. Jul 23, 2021
  16. Jul 22, 2021
  17. Jul 21, 2021
  18. Jul 20, 2021
Loading