Skip to content

Commit b95bb14

Browse files
author
Timur Gilmullin
committed
#14: Increase code quality with the Codacy service - 2
1 parent 616e487 commit b95bb14

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

FuzzyRoutines.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def Hyperbolic(self, x):
291291
else:
292292
result = 1 / (1 + (a * (x - c)) ** b)
293293

294-
except:
294+
except Exception:
295295
FCLogger.error(traceback.format_exc())
296296
FCLogger.error('Hyperbolic membership function use real inputs x and parameters a, b, c.')
297297
FCLogger.error('Your inputs: mju_hyperbolic({}, {}, {}, {})'.format(x, a, b, c))
@@ -328,7 +328,7 @@ def Bell(self, x):
328328
self._parameters['a'] = aOld
329329
self._parameters['b'] = bOld
330330

331-
except:
331+
except Exception:
332332
FCLogger.error(traceback.format_exc())
333333
FCLogger.error('Bell membership function use real inputs x and parameters a, b, c.')
334334
FCLogger.error('Your inputs: mju_bell({}, {}, {}, {})'.format(x, a, b, c))
@@ -358,7 +358,7 @@ def Parabolic(self, x):
358358
else:
359359
result = 1
360360

361-
except:
361+
except Exception:
362362
FCLogger.error(traceback.format_exc())
363363
FCLogger.error('Parabolic membership function use real inputs x and parameters a, b.')
364364
FCLogger.error('Your inputs: mju_parabolic({}, {}, {})'.format(x, a, b))
@@ -389,7 +389,7 @@ def Triangle(self, x):
389389
else:
390390
result = 0
391391

392-
except:
392+
except Exception:
393393
FCLogger.error(traceback.format_exc())
394394
FCLogger.error('Triangle membership function use real inputs x and parameters a, b, c.')
395395
FCLogger.error('Your inputs: mju_triangle({}, {}, {}, {})'.format(x, a, b, c))
@@ -424,7 +424,7 @@ def Trapezium(self, x):
424424
else:
425425
result = 0
426426

427-
except:
427+
except Exception:
428428
FCLogger.error(traceback.format_exc())
429429
FCLogger.error('Trapezium membership function use real inputs x and parameters a, b, c, d.')
430430
FCLogger.error('Your inputs: mju_trapezium({}, {}, {}, {}, {})'.format(x, a, b, c, d))
@@ -445,7 +445,7 @@ def Exponential(self, x):
445445
if b != 0:
446446
result = math.exp(1) ** (-0.5 * ((x - a) / b) ** 2)
447447

448-
except:
448+
except Exception:
449449
FCLogger.error(traceback.format_exc())
450450
FCLogger.error('Exponential membership function use real inputs x and parameters a, b.')
451451
FCLogger.error('Your inputs: mju_exponential({}, {}, {})'.format(x, a, b))
@@ -465,7 +465,7 @@ def Sigmoidal(self, x):
465465

466466
result = 1 / (1 + math.exp(1) ** (-a * (x - b)))
467467

468-
except:
468+
except Exception:
469469
FCLogger.error(traceback.format_exc())
470470
FCLogger.error('Sigmoidal membership function use real inputs x and parameters a, b.')
471471
FCLogger.error('Your inputs: mju_sigmoidal({}, {}, {})'.format(x, a, b))
@@ -477,12 +477,10 @@ def Desirability(self, y):
477477
"""
478478
This is Harrington's desirability membership function with real input y without any parameters.
479479
"""
480-
result = 0
481-
482480
try:
483481
result = math.exp(-math.exp(-y))
484482

485-
except:
483+
except Exception:
486484
FCLogger.error(traceback.format_exc())
487485
FCLogger.error("Harrington's desirability membership function use only real input y without any parameters.")
488486
FCLogger.error('Your inputs: mju_desirability({})'.format(y))
@@ -629,7 +627,7 @@ def __str__(self):
629627
# High = <Triangle(x, {"a": 0.7, "b": 1, "c": 1}), [0.0, 1.0]>
630628
allLevelsName = self._levels[0]['name']
631629
allLevels = '\n {}'.format(self._levels[0]['fSet'].__str__())
632-
630+
633631
for level in self._levels[1:]:
634632
allLevelsName += ', {}'.format(level['name'])
635633
allLevels += '\n {}'.format(str(level['fSet']))

0 commit comments

Comments
 (0)