1. 02 Dec, 2021 1 commit
  2. 01 Dec, 2021 1 commit
  3. 30 Nov, 2021 1 commit
  4. 25 Nov, 2021 1 commit
    • Nsukami Patrick's avatar
      [mypy]: add IsASelectionManager protocol · e6108b6d8056
      Nsukami Patrick authored
      update undo_manager property, type:
        self._undo_manager as SelectionManager
      and fix:
        rql/stmts.py:424: error: Cannot determine type of "_undo_manager" [has-type]
      
      rewrite the undo_manager function and make sure it always returns a SelectionManager
      e6108b6d8056
  5. 24 Nov, 2021 3 commits
  6. 25 Nov, 2021 3 commits
  7. 23 Nov, 2021 2 commits
    • Nsukami Patrick'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'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
  8. 09 Oct, 2021 2 commits
    • Nsukami Patrick'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'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. 13 Jul, 2021 1 commit
    • Nsukami Patrick'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
  10. 04 Aug, 2021 1 commit
    • Nsukami Patrick'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
  11. 23 Jul, 2021 3 commits
    • Nsukami Patrick's avatar
      mypy: Remove useless import · a1d40ebd1f7a
      Nsukami Patrick authored
      a1d40ebd1f7a
    • Nsukami Patrick's avatar
      mypy: Improve various type hints · 847f5057c319
      Nsukami Patrick authored
      Update rql.base.Node class:
      - define self.parent as a TypeVar
      - define self.children as a List of TypeVar
      - Those 2 TypeVar are bound, i.e: they can be BaseNode or any children of BaseNode
      
      Update rql.stmts.Union class:
      - add a new attribute, i.e:  `children: List["rql.stmts.Select"]`
      
      Update rql.RQLHelper simplify & _simplify methods:
      - remove call to cast method, no more need to cast from BaseNode to Select
      
      Also:
      - Try to harmonize type signature for get_description methods
      - Remove now obsolete comments related to type hints
      - type vconsts as a List of Constant
      847f5057c319
    • Nsukami Patrick's avatar
      mypy: Improve type hint for RQLHelpher __init__ method · be0dbd62da07
      Nsukami Patrick authored
      - RQLHelper __init__ method takes a parameter `resolver_class`
      - `revolver_class` is anything implementing the interface of ETypeResolver class
      - create a protocol named `ResolvesEType` that respect that interface
      be0dbd62da07
  12. 22 Jul, 2021 1 commit
  13. 20 Jul, 2021 2 commits
  14. 11 Jul, 2021 2 commits
  15. 03 Jun, 2021 1 commit
    • Nsukami Patrick's avatar
      mypy: Type hint the undo module · 2d4b69c7a89c
      Nsukami Patrick authored
      - add Op type as a list of all operations
      - type hint SelectionMgr class
      - should we make NodeOperation class truly abstract?
      - type hint NodeOperation class
      - add undo method inside NodeOperation class to make Op type more consistent
      2d4b69c7a89c
  16. 22 Jun, 2021 1 commit
  17. 14 Jun, 2021 1 commit
    • Frank Bessou's avatar
      mypy: Use protocol to declare type of translation function · a785fee4735d
      Frank Bessou authored
      1. Define a custom type: TranslationFunction:
      This depends on `Protocol` which is only available on python >= 3.8.
      `typing_extensions` provides it for lower versions.
      
      2. Update get_description function signature:
      For `tr` parameter, Use TranslationFunction instead of Callable[[str, str], str]
      
      3. get_description signature redefined, stop ignoring call-arg errors
      a785fee4735d
  18. 08 Jun, 2021 1 commit
  19. 14 Jun, 2021 1 commit
  20. 03 Jun, 2021 2 commits
  21. 27 Apr, 2021 1 commit
    • Nsukami Patrick's avatar
      mypy: Add types within stcheck.py module · fe99689fd731
      Nsukami Patrick authored
      - Add types within stcheck.py module
      - Update the accept & leave methods signatures inside the VisitableMixIn class
      - Redefine type (and set a type alias) for Select.vargraph attribute
      fe99689fd731
  22. 16 Apr, 2021 2 commits
  23. 30 Mar, 2021 1 commit
  24. 16 Mar, 2021 1 commit
  25. 23 Mar, 2021 1 commit
  26. 09 Mar, 2021 1 commit
  27. 02 Mar, 2021 1 commit
  28. 16 Feb, 2021 1 commit
    • Nsukami Patrick's avatar
      [mypy] Add more types: · d5f92ab3fd53
      Nsukami Patrick authored
      Add more types within the following modules:
      - rql/utils.py
      - rql/interfaces.py
      - rql/rqlgen.py
      d5f92ab3fd53