Skip to content

Commit

Permalink
Make mypy (type hints) happy
Browse files Browse the repository at this point in the history
@Property, its setter and @AbstractMethod
do not work well together in mypy.
This fix was suggested in a GitHub issue:
python/mypy#4165
  • Loading branch information
kunathj committed Jul 9, 2021
1 parent 617d7b4 commit 7104a1a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/alldecays/data_handling/abstract_data_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,56 @@ def decay_names(self):
pass

@decay_names.setter
@abstractmethod
def decay_names(self, new_names):
pass
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError

@property
@abstractmethod
def data_brs(self):
pass

@data_brs.setter
@abstractmethod
def data_brs(self, new_names):
pass
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError

@property
@abstractmethod
def fit_start_brs(self):
pass

@fit_start_brs.setter
@abstractmethod
def fit_start_brs(self, new_names):
pass
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError

@property
@abstractmethod
def luminosity_ifb(self):
pass

@luminosity_ifb.setter
@abstractmethod
def luminosity_ifb(self, new_names):
pass
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError

@property
@abstractmethod
def signal_scaler(self):
pass

@signal_scaler.setter
@abstractmethod
def signal_scaler(self, new_names):
pass
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError

0 comments on commit 7104a1a

Please sign in to comment.