__init__
PYL-W0201 6
7 def process_input(self, input_data):
8 doc = self.nlp(input_data)
9 self.entities = [ent.text for ent in doc.ents]10
11 def get_entities(self):
12 return self.entities
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.