Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_generate_cover_settings(param):
vlist = []
for line in param.splitlines():
if "=>" in line:
try:
(template,regexp,setting) = [ x.strip() for x in line.split("=>") ]
re_compile(regexp,line)
vlist.append((template,regexp,setting))
except Exception as e:
raise exceptions.PersonalIniFailed(e,line,param)
return vlist
if len(parts) > 2:
metakeys = [x.strip() for x in parts[0].split(",")]
(regexp,replacement)=parts[1:]
else:
(regexp,replacement)=parts
if regexp:
regexp = re_compile(regexp,line)
# A way to explicitly include spaces in the
# replacement string. The .ini parser eats any
# trailing spaces.
replacement=replacement.replace(SPACE_REPLACE,' ')
retval.append([repl_line,metakeys,regexp,replacement,cond_match])
except Exception as e:
logger.error("Problem with Replacement Line:%s"%repl_line)
raise exceptions.PersonalIniFailed(e,'replace_metadata unpacking failed',repl_line)
# raise
# print("replace lines:%s"%len(retval))
return retval
def make_generate_cover_settings(param):
vlist = []
for line in param.splitlines():
if "=>" in line:
try:
(template,regexp,setting) = [ x.strip() for x in line.split("=>") ]
re_compile(regexp,line)
vlist.append((template,regexp,setting))
except Exception as e:
raise exceptions.PersonalIniFailed(e,line,param)
return vlist
def _getParsingConfiguration(self):
if not self._parsingConfiguration:
self._parsingConfiguration = {}
adultRatings = self.getConfigList('adult_ratings')
if not adultRatings:
raise exceptions.PersonalIniFailed(
u"Missing `adult_ratings' setting", u"MassEffect2.in", u"?")
adultRatings = set(adultRatings)
self._parsingConfiguration['adultRatings'] = adultRatings
ratingTitleDescriptions = self.getConfigList('rating_titles')
if ratingTitleDescriptions:
ratingTitles = {}
for ratingDescription in ratingTitleDescriptions:
parts = ratingDescription.split(u'=')
if len(parts) < 2:
logger.warning(
u"Invalid `rating_titles' setting, missing `=' in `%s'."
% ratingDescription)
continue
labels = parts[:-1]
title = parts[-1]
if len(parts) < 2:
logger.warning(
u"Invalid `rating_titles' setting, missing `=' in `%s'."
% ratingDescription)
continue
labels = parts[:-1]
title = parts[-1]
for label in labels:
ratingTitles[label] = title
# Duplicate label aliasing in adult rating set.
if label in adultRatings:
adultRatings.add(*labels)
self._parsingConfiguration['adultRatings'] = list(adultRatings)
self._parsingConfiguration['ratingTitles'] = ratingTitles
else:
raise exceptions.PersonalIniFailed(
u"Missing `rating_titles' setting", u"MassEffect2.in", u"?")
self._parsingConfiguration['excludeEditorSignature'] = \
self.getConfig('exclude_editor_signature', False)
return self._parsingConfiguration
def __init__(self,error,part,line):
PersonalIniFailed.__init__(self,error,part,line)