pep8-compat: clean up CountryList-Modul
This commit is contained in:
@@ -126,11 +126,11 @@ class CountryList():
|
|||||||
Detect wether current entry is on of the belgian (Belgien/Wallonien)
|
Detect wether current entry is on of the belgian (Belgien/Wallonien)
|
||||||
"""
|
"""
|
||||||
# Check if begian province name is in link text or title
|
# Check if begian province name is in link text or title
|
||||||
if "Wallonien" in str( self.wikilink.text ) \
|
if( "Wallonien" in str( self.wikilink.text ) or
|
||||||
or "Wallonien" in str( self.wikilink.title):
|
"Wallonien" in str( self.wikilink.title) ):
|
||||||
return "Wallonie"
|
return "Wallonie"
|
||||||
elif "Flandern" in str( self.wikilink.text ) \
|
elif( "Flandern" in str( self.wikilink.text ) or
|
||||||
or "Flandern" in str( self.wikilink.title):
|
"Flandern" in str( self.wikilink.title) ):
|
||||||
return "Flandern"
|
return "Flandern"
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@@ -155,21 +155,21 @@ class CountryList():
|
|||||||
singles_section = self.wikicode.get_sections(
|
singles_section = self.wikicode.get_sections(
|
||||||
matches=belgian )[0].get_sections( matches="Singles" )[0]
|
matches=belgian )[0].get_sections( matches="Singles" )[0]
|
||||||
else:
|
else:
|
||||||
singles_section = self.wikicode.get_sections( matches="Singles" )[0]
|
singles_section = self.wikicode.get_sections(matches="Singles")[0]
|
||||||
|
|
||||||
# Since we have multiple categories in some countrys we need
|
# Since we have multiple categories in some countrys we need
|
||||||
# to select the first wrapping template
|
# to select the first wrapping template
|
||||||
try:
|
try:
|
||||||
wrapping_template = next( singles_section.ifilter_templates(
|
wrapping = next( singles_section.ifilter_templates(
|
||||||
matches="Nummer-eins-Hits" ) )
|
matches="Nummer-eins-Hits" ) )
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
raise CountryListError( "Wrapping template is missing!")
|
raise CountryListError( "Wrapping template is missing!")
|
||||||
|
|
||||||
# Select the last occurence of template "Nummer-eins-Hits Zeile" in
|
# Select the last occurence of template "Nummer-eins-Hits Zeile" in
|
||||||
# Wrapper-template
|
# Wrapper-template
|
||||||
for self.entry in wrapping_template.get("Inhalt").value.ifilter_templates(
|
for self.entry in wrapping.get("Inhalt").value.ifilter_templates(
|
||||||
matches="Nummer-eins-Hits Zeile" ):
|
matches="Nummer-eins-Hits Zeile" ):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Check if we have found something
|
# Check if we have found something
|
||||||
if not self.entry:
|
if not self.entry:
|
||||||
@@ -303,8 +303,8 @@ missing!" )
|
|||||||
for index in indexes:
|
for index in indexes:
|
||||||
|
|
||||||
# Check wether wikilink matches
|
# Check wether wikilink matches
|
||||||
if parts[index] == wikilink.text \
|
if( parts[index] == wikilink.text or
|
||||||
or parts[index] == wikilink.title:
|
parts[index] == wikilink.title ):
|
||||||
|
|
||||||
# Overwrite name with complete wikilink
|
# Overwrite name with complete wikilink
|
||||||
parts[index] = str( wikilink )
|
parts[index] = str( wikilink )
|
||||||
@@ -345,6 +345,7 @@ class CountryListError( Exception ):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CountryListEntryError( CountryListError ):
|
class CountryListEntryError( CountryListError ):
|
||||||
"""
|
"""
|
||||||
Handles errors occuring in class CountryList related to entrys
|
Handles errors occuring in class CountryList related to entrys
|
||||||
|
|||||||
Reference in New Issue
Block a user