Commits

Michał Górny committed 25f6998

Split __new__() into __new__()+__init__() in StringCompat subclasses.

Comments (0)

Files changed (7)

gentoopm/basepm/depend.py

 	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):

gentoopm/paludispm/atom.py

 
 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):
 
 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):

gentoopm/paludispm/pkg.py

 
 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):
 
 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):

gentoopm/pkgcorepm/atom.py

 
 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):
 	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):

gentoopm/pkgcorepm/pkg.py

 
 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):

gentoopm/portagepm/atom.py

 
 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):

gentoopm/portagepm/pkg.py

 
 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):
 
 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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.