Skip to content
  • Nsukami Patrick <ptrck at nskm dot xyz>'s avatar
    [mypy]: Fix various errors · c312ff9d2c1b
    Nsukami Patrick authored
    Updates:
    --------
    - Annotate cardinality attribute as a Union of nullobject, str, None.
    - assert cardinality is an instance of str if not an instance of nullobject
    
    
    To fix the following errors:
    ----------------------------
    yams/buildobjs.py:1071: error: Incompatible types in assignment (expression has type "str", variable has type "nullobject")  [assignment]
    		    self.cardinality = "?1"
    				       ^
    yams/buildobjs.py:1073: error: Incompatible types in assignment (expression has type "str", variable has type "nullobject")  [assignment]
    		    self.cardinality = "**"
    				       ^
    yams/buildobjs.py:1075: error: Argument 1 to "len" has incompatible type "nullobject"; expected "Sized"  [arg-type]
    		assert len(cardinality) == 2
    			   ^
    yams/buildobjs.py:1076: error: Value of type "nullobject" is not indexable  [index]
    		assert cardinality[0] in "1?+*"
    		       ^
    yams/buildobjs.py:1077: error: Value of type "nullobject" is not indexable  [index]
    		assert cardinality[1] in "1?+*"
    c312ff9d2c1b