From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/pkgcorepm/, gentoopm/paludispm/, gentoopm/basepm/
Date: Mon, 15 Aug 2011 09:01:10 +0000 (UTC) [thread overview]
Message-ID: <25f69989d8f27d4e7557f94d684c83e216f8332b.mgorny@gentoo> (raw)
commit: 25f69989d8f27d4e7557f94d684c83e216f8332b
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 15 09:02:19 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 15 09:02:19 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=25f69989
Split __new__() into __new__()+__init__() in StringCompat subclasses.
---
gentoopm/basepm/depend.py | 10 ++++------
gentoopm/paludispm/atom.py | 14 ++++++++------
gentoopm/paludispm/pkg.py | 14 ++++++++------
gentoopm/pkgcorepm/atom.py | 14 ++++++++------
gentoopm/pkgcorepm/pkg.py | 7 ++++---
gentoopm/portagepm/atom.py | 7 ++++---
gentoopm/portagepm/pkg.py | 14 ++++++++------
7 files changed, 44 insertions(+), 36 deletions(-)
diff --git a/gentoopm/basepm/depend.py b/gentoopm/basepm/depend.py
index b765445..881c433 100644
--- a/gentoopm/basepm/depend.py
+++ b/gentoopm/basepm/depend.py
@@ -12,13 +12,11 @@ class PMRequiredUseAtom(StringCompat):
An atom for C{REQUIRED_USE} specification.
"""
- def __new__(self, s):
- rua = StringCompat.__new__(self, s)
- rua._blocks = s.startswith('!')
- if rua._blocks:
+ def __init__(self, s):
+ self._blocks = s.startswith('!')
+ if self._blocks:
s = s[1:]
- rua._flag = s
- return rua
+ self._flag = s
@property
def name(self):
diff --git a/gentoopm/paludispm/atom.py b/gentoopm/paludispm/atom.py
index 71ed9db..d8ee5cf 100644
--- a/gentoopm/paludispm/atom.py
+++ b/gentoopm/paludispm/atom.py
@@ -13,9 +13,10 @@ _category_wildcard_re = re.compile(r'\w')
class PaludisPackageKey(PMPackageKey):
def __new__(self, key):
- k = PMPackageKey.__new__(self, str(key))
- k._k = key
- return k
+ return PMPackageKey.__new__(self, str(key))
+
+ def __init__(self, key):
+ self._k = key
@property
def category(self):
@@ -31,9 +32,10 @@ class PaludisIncompletePackageKey(PMIncompletePackageKey):
class PaludisPackageVersion(PMPackageVersion):
def __new__(self, ver):
- v = PMPackageVersion.__new__(self, str(ver))
- v._v = ver
- return v
+ return PMPackageVersion.__new__(self, str(ver))
+
+ def __init__(self, ver):
+ self._v = ver
@property
def without_revision(self):
diff --git a/gentoopm/paludispm/pkg.py b/gentoopm/paludispm/pkg.py
index 9ccfed1..5b19b98 100644
--- a/gentoopm/paludispm/pkg.py
+++ b/gentoopm/paludispm/pkg.py
@@ -17,11 +17,12 @@ from .depend import PaludisPackageDepSet
class PaludisBoundPackageKey(PaludisPackageKey, PMBoundPackageKey):
def __new__(self, key, pkg):
- k = PaludisPackageKey.__new__(self, key)
- k._state = PMPackageState(
+ return PaludisPackageKey.__new__(self, key)
+
+ def __init__(self, key, pkg):
+ self._state = PMPackageState(
installable = isinstance(pkg, PaludisInstallableID),
installed = isinstance(pkg, PaludisInstalledID))
- return k
@property
def state(self):
@@ -42,9 +43,10 @@ class PaludisPackageDescription(PMPackageDescription):
class PaludisChoice(PMUseFlag):
def __new__(self, choice):
- uf = PMUseFlag.__new__(self, str(choice.name_with_prefix))
- uf._c = choice
- return uf
+ return PMUseFlag.__new__(self, str(choice.name_with_prefix))
+
+ def __init__(self, choice):
+ self._c = choice
@property
def enabled(self):
diff --git a/gentoopm/pkgcorepm/atom.py b/gentoopm/pkgcorepm/atom.py
index 65892b3..a7e7720 100644
--- a/gentoopm/pkgcorepm/atom.py
+++ b/gentoopm/pkgcorepm/atom.py
@@ -27,9 +27,10 @@ def _find_res(res, cls):
class PkgCorePackageKey(PMPackageKey):
def __new__(self, atom):
- k = PMPackageKey.__new__(self, atom.key)
- k._atom = atom
- return k
+ return PMPackageKey.__new__(self, atom.key)
+
+ def __init__(self, atom):
+ self._atom = atom
@property
def category(self):
@@ -50,9 +51,10 @@ class PkgCorePackageVersion(PMPackageVersion):
def __new__(self, atom):
if atom.version is None:
raise AssertionError('Empty version in atom')
- v = PMPackageVersion.__new__(self, atom.fullver)
- v._atom = atom
- return v
+ return PMPackageVersion.__new__(self, atom.fullver)
+
+ def __init__(self, atom):
+ self._atom = atom
@property
def without_revision(self):
diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index d2ca767..8782433 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -47,9 +47,10 @@ class PkgCorePackageDescription(PMPackageDescription):
class PkgCoreUseFlag(PMUseFlag):
def __new__(self, s, enabled_use):
- uf = PMUseFlag.__new__(self, s)
- uf._enabled = self.name in enabled_use
- return uf
+ return PMUseFlag.__new__(self, s)
+
+ def __init__(self, s, enabled_use):
+ self._enabled = self.name in enabled_use
@property
def enabled(self):
diff --git a/gentoopm/portagepm/atom.py b/gentoopm/portagepm/atom.py
index c4f76b7..c9c7874 100644
--- a/gentoopm/portagepm/atom.py
+++ b/gentoopm/portagepm/atom.py
@@ -29,9 +29,10 @@ class PortageIncompletePackageKey(PMIncompletePackageKey, PortagePackageKey):
class PortagePackageVersion(PMPackageVersion):
def __new__(self, cpv):
- v = PMPackageVersion.__new__(self, cpv_getversion(cpv))
- v._cpv = cpv
- return v
+ return PMPackageVersion.__new__(self, cpv_getversion(cpv))
+
+ def __init__(self, cpv):
+ self._cpv = cpv
@property
def without_revision(self):
diff --git a/gentoopm/portagepm/pkg.py b/gentoopm/portagepm/pkg.py
index 5ad9cb3..1a7661f 100644
--- a/gentoopm/portagepm/pkg.py
+++ b/gentoopm/portagepm/pkg.py
@@ -29,11 +29,12 @@ class PortageFilteredPackageSet(PortagePackageSet, PMFilteredPackageSet):
class PortageBoundPackageKey(PortagePackageKey, PMBoundPackageKey):
def __new__(self, cp, pkg):
- k = PortagePackageKey.__new__(self, cp)
- k._state = PMPackageState(
+ return PortagePackageKey.__new__(self, cp)
+
+ def __init__(self, cp, pkg):
+ self._state = PMPackageState(
installable = isinstance(pkg, PortageCPV),
installed = isinstance(pkg, PortageVDBCPV))
- return k
@property
def state(self):
@@ -59,9 +60,10 @@ class PortagePackageDescription(PMPackageDescription):
class PortageUseFlag(PMUseFlag):
def __new__(self, s, enabled_use):
- uf = PMUseFlag.__new__(self, s)
- uf._enabled = self.name in enabled_use
- return uf
+ return PMUseFlag.__new__(self, s)
+
+ def __init__(self, s, enabled_use):
+ self._enabled = self.name in enabled_use
@property
def enabled(self):
next reply other threads:[~2011-08-15 9:01 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-15 9:01 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-09-16 7:39 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/pkgcorepm/, gentoopm/paludispm/, gentoopm/basepm/ Michał Górny
2011-08-15 8:48 Michał Górny
2011-08-15 7:57 Michał Górny
2011-08-14 14:22 Michał Górny
2011-08-12 8:24 Michał Górny
2011-08-01 17:14 Michał Górny
2011-07-30 18:39 Michał Górny
2011-07-30 8:13 Michał Górny
2011-07-28 19:54 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-27 21:32 Michał Górny
2011-07-27 16:24 Michał Górny
2011-07-27 16:24 Michał Górny
2011-07-23 9:27 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-20 18:02 Michał Górny
2011-07-20 9:41 Michał Górny
2011-07-19 11:53 Michał Górny
2011-07-18 17:54 Michał Górny
2011-07-18 14:40 Michał Górny
2011-07-15 22:24 Michał Górny
2011-07-15 22:24 Michał Górny
2011-07-14 14:05 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-14 12:19 Michał Górny
2011-07-13 16:09 Michał Górny
2011-07-13 16:09 Michał Górny
2011-07-12 8:31 Michał Górny
2011-07-07 12:52 Michał Górny
2011-07-07 9:51 Michał Górny
2011-07-06 20:54 Michał Górny
2011-07-06 16:03 Michał Górny
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=25f69989d8f27d4e7557f94d684c83e216f8332b.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@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