Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix: improving the usage of False which is contradictory somethimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jagalindo committed Aug 25, 2023
1 parent 5d0fe2c commit 8e24cb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions flamapy/interfaces/python/FLAMAFeatureModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def atomic_sets(self):
result.append(partial_set)
return result
except:
return False
return None

def average_branching_factor(self):
"""
Expand All @@ -70,7 +70,7 @@ def average_branching_factor(self):
result = self.dm.use_operation(self.fm_model,'FMAverageBranchingFactor').get_result()
return result
except:
return False
return None

def count_leafs(self):
"""
Expand All @@ -84,7 +84,7 @@ def count_leafs(self):
result = self.dm.use_operation(self.fm_model,'FMCountLeafs').get_result()
return result
except:
return False
return None

def estimated_number_of_products(self):
"""
Expand All @@ -100,7 +100,7 @@ def estimated_number_of_products(self):
result = self.dm.use_operation(self.fm_model,'FMEstimatedProductsNumber').get_result()
return result
except:
return False
return None

def feature_ancestors(self,feature_name:str):
'''
Expand All @@ -119,7 +119,7 @@ def feature_ancestors(self,feature_name:str):
result.append(res.name)
return result
except:
return False
return None


def leaf_features(self):
Expand All @@ -143,7 +143,7 @@ def leaf_features(self):
leaf_features.append(feature.name)
return leaf_features
except:
return False
return None

def max_depth(self):
"""
Expand All @@ -157,7 +157,7 @@ def max_depth(self):
try:
return self.dm.use_operation(self.fm_model,'FMMaxDepthTree').get_result()
except:
return False
return None
"""
The methods above rely on sat to be executed.
"""
Expand All @@ -177,7 +177,7 @@ def commonality(self, configurationPath:str):
return operation.get_result()

except:
return False
return None

def core_features(self):
"""
Expand All @@ -191,7 +191,7 @@ def core_features(self):
features = self.dm.use_operation(self.sat_model,'Glucose3CoreFeatures').get_result()
return features
except:
return False
return None

def dead_features(self):
"""
Expand All @@ -204,7 +204,7 @@ def dead_features(self):
features = self.dm.use_operation(self.sat_model,'Glucose3DeadFeatures').get_result()
return features
except:
return False
return None

def error_detection(self):
"""
Expand All @@ -222,7 +222,7 @@ def error_detection(self):
result = operation.get_result()
return result
except:
return False
return None

def false_optional_features(self):
"""
Expand All @@ -239,7 +239,7 @@ def false_optional_features(self):
features = operation.get_result()
return features
except:
return False
return None

def filter(self, configurationPath:str):
"""
Expand All @@ -256,7 +256,7 @@ def filter(self, configurationPath:str):
result = operation.get_result()
return result
except:
return False
return None

def products_number(self):
"""
Expand All @@ -269,7 +269,7 @@ def products_number(self):
nop = self.dm.use_operation(self.sat_model,'Glucose3ProductsNumber').get_result()
return nop
except:
return False
return None

def products(self):
"""
Expand All @@ -282,7 +282,7 @@ def products(self):
products = self.dm.use_operation(self.sat_model,'Glucose3Products').get_result()
return products
except:
return False
return None

def valid_configuration(self, configurationPath:str):
"""
Expand All @@ -299,7 +299,7 @@ def valid_configuration(self, configurationPath:str):
result = operation.get_result()
return result
except:
return False
return None

def valid_product(self, configurationPath:str):
"""
Expand All @@ -315,7 +315,7 @@ def valid_product(self, configurationPath:str):
result = operation.get_result()
return result
except:
return False
return None

def valid(self):
"""
Expand All @@ -328,6 +328,6 @@ def valid(self):
result = self.dm.use_operation(self.sat_model,'Glucose3Valid').get_result()
return result
except:
return False
return None


2 changes: 1 addition & 1 deletion flamapy/interfaces/rest/operations_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _api_call(operation_name:str):
os.remove(os.path.join(MODEL_FOLDER, uploaded_model.filename))

# Return result
if (result == False):
if (result is None):
return jsonify(error='Not valid result'), 404
else:
return jsonify(result)
Expand Down

0 comments on commit 8e24cb9

Please sign in to comment.