14574 return self.findallbyre(r'(?s)<p class="bronnen">(.*?)<', html,
14575 'source')
14576
14577 def findtitles(self, html: str):14578 section = self.findbyre(r'(?s)Adelstitel:(.*?)<', html)
14579 if section:
14580 return self.findallbyre(r'([a-zA-Z][\w\s]*)', section, 'title')
14507 r'†\s*<span>[^<>]*</span>,\s*<span>(.*?)</span>', html,
14508 'city')
14509
14510 def findoccupations(self, html: str):14511 section = self.findbyre(r'<br>([^<>]*)</p>', html)
14512 if section:
14513 return self.findallbyre(r'([^,]*)', section, 'occupation')
14464 r'\(Person\)(?:\s|<[^<>]*>)*<div class="singleRow">(.*?)<', html,
14465 'gender')
14466
14467 def findnationalities(self, html: str):14468 section = self.findbyre('(?s)<h2>Nationality</h2>(.*?)<h2', html)
14469 if section:
14470 return self.findallbyre('([^,]*)', section, 'occupation')
14442 def finddescription(self, html: str):
14443 return self.findbyre('(?s)<h2>Occupation</h2>(.*?)<h2', html)
14444
14445 def findoccupations(self, html: str):14446 section = self.findbyre('(?s)<h2>Occupation</h2>(.*?)<h2', html)
14447 if section:
14448 return self.findallbyre('([^,]*)', section, 'occupation')
14380 if deathdata:
14381 return self.findbyre(r'(.*\d),', deathdata)
14382
14383 def finddeathplace(self, html: str):14384 deathdata = self.getvalue('Overleden', html)
14385 if deathdata:
14386 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)