Le 14/02/2015 20:03, Anthony G. Basile a écrit :
> 

In the last chunk of modules/generic_stage_target.py:

* type(var) == types.DictType can be replaced with
  isinstance(var, dict).

  Same thing for StringType/str, ListType/list and BooleanType/bool.
  This is how simple types were checked before Python 2.2 (around 2002).

* string.replace has been deprecated for ages, use str.replace directly:

  varname2="clst_"+string.replace(y,"/","_")
  varname2=string.replace(varname2,"-","_")
  varname2=string.replace(varname2,".","_")

  becomes

  varname2 = "clst_" + y.replace("/", "_")
  varname2 = varname2.replace("-", "_")
  varname2 = varname2.replace(".", "_")

* string.join is also deprecated, use ' '.join() instead

* dict objects are iterable (and they return keys). This means that

  string.join(self.settings[x].keys())

  can be written (with the join suggestion above):

  ' '.join(self.settings[x])

* You may want to use dict.items() to get both the key and the
  associated value:

  for y in self.settings[x].keys():

  becomes:

  for y, val in self.settings[x].items():

  which should allow you to replace "self.settings[x][y]" with "val"

Cheers,

Rémi

Reply via email to