14577 return self.findallbyre(r'(?s)<p class="bronnen">(.*?)<', html,
14578 'source')
14579
14580 def findtitles(self, html: str):14581 section = self.findbyre(r'(?s)Adelstitel:(.*?)<', html)
14582 if section:
14583 return self.findallbyre(r'([a-zA-Z][\w\s]*)', section, 'title')
14510 r'†\s*<span>[^<>]*</span>,\s*<span>(.*?)</span>', html,
14511 'city')
14512
14513 def findoccupations(self, html: str):14514 section = self.findbyre(r'<br>([^<>]*)</p>', html)
14515 if section:
14516 return self.findallbyre(r'([^,]*)', section, 'occupation')
14467 r'\(Person\)(?:\s|<[^<>]*>)*<div class="singleRow">(.*?)<', html,
14468 'gender')
14469
14470 def findnationalities(self, html: str):14471 section = self.findbyre('(?s)<h2>Nationality</h2>(.*?)<h2', html)
14472 if section:
14473 return self.findallbyre('([^,]*)', section, 'occupation')
14445 def finddescription(self, html: str):
14446 return self.findbyre('(?s)<h2>Occupation</h2>(.*?)<h2', html)
14447
14448 def findoccupations(self, html: str):14449 section = self.findbyre('(?s)<h2>Occupation</h2>(.*?)<h2', html)
14450 if section:
14451 return self.findallbyre('([^,]*)', section, 'occupation')
14383 if deathdata:
14384 return self.findbyre(r'(.*\d),', deathdata)
14385
14386 def finddeathplace(self, html: str):14387 deathdata = self.getvalue('Overleden', html)
14388 if deathdata:
14389 return self.findbyre(r'.*\d,(.*)', deathdata, 'city')
According to PEP8, if any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None
, and an explicit return statement should be present at the end of the function (if reachable).
Good:
def foo(x):
if x >= 0:
return math.sqrt(x)
else:
return None
def bar(x):
if x < 0:
return None
return math.sqrt(x)
Bad:
def foo(x):
if x >= 0:
return math.sqrt(x)
def bar(x):
if x < 0:
return
return math.sqrt(x)