PLCGenerator.py
changeset 1862 c4ba411f8c89
parent 1847 6198190bc121
child 1863 46d9955e1101
--- a/PLCGenerator.py	Tue Oct 10 13:49:13 2017 +0300
+++ b/PLCGenerator.py	Tue Oct 10 14:01:46 2017 +0300
@@ -995,7 +995,7 @@
         uncomputed_index = range(len(paths))
         factorized_paths = []
         for num, path in enumerate(paths):
-            if type(path) == ListType:
+            if isinstance(path, ListType):
                 if len(path) > 1:
                     str_path = str(path[-1:])
                     same_paths.setdefault(str_path, [])
@@ -1261,7 +1261,7 @@
                         paths.append([variable, tuple(factorized_paths)])
                     else:
                         paths.append([variable] + factorized_paths)
-                elif type(result[0]) == ListType:
+                elif isinstance(result[0], ListType):
                     paths.append([variable] + result[0])
                 elif result[0] is not None:
                     paths.append([variable, result[0]])
@@ -1272,7 +1272,7 @@
         return paths
 
     def ComputePaths(self, paths, first=False):
-        if type(paths) == TupleType:
+        if isinstance(paths, TupleType):
             if None in paths:
                 return [("TRUE", ())]
             else:
@@ -1281,7 +1281,7 @@
                     return JoinList([(" OR ", ())], vars)
                 else:
                     return [("(", ())] + JoinList([(" OR ", ())], vars) + [(")", ())]
-        elif type(paths) == ListType:
+        elif isinstance(paths, ListType):
             vars = [self.ComputePaths(path) for path in paths]
             return JoinList([(" AND ", ())], vars)
         elif paths is None: