From: "Rémi Cardona" <remi@gentoo.org>
To: gentoo-releng@lists.gentoo.org
Subject: Re: [gentoo-releng] Enable USE_EXPAND support in catalyst
Date: Sun, 15 Feb 2015 08:54:37 +0100 [thread overview]
Message-ID: <54E050BD.5010209@gentoo.org> (raw)
In-Reply-To: <54DF9C00.4010008@opensource.dyc.edu>
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
next prev parent reply other threads:[~2015-02-15 7:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-14 19:03 [gentoo-releng] Enable USE_EXPAND support in catalyst Anthony G. Basile
2015-02-14 20:22 ` Matt Turner
2015-02-14 20:47 ` Anthony G. Basile
2015-02-15 7:54 ` Rémi Cardona [this message]
2015-02-15 16:48 ` Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E050BD.5010209@gentoo.org \
--to=remi@gentoo.org \
--cc=gentoo-releng@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox