commit 5f0cd3b89fbe0808aed19419180d7f9546d50d38 Author: Michal Srb msrb@redhat.com Date: Wed Jun 4 10:04:05 2014 +0200
Remove unneeded stuff from subclasses
python/javapackages/pom/dependency.py | 23 ++--------------------- python/javapackages/pom/exclusion.py | 24 +----------------------- python/javapackages/pom/extension.py | 25 +------------------------ python/javapackages/pom/plugin.py | 21 ++------------------- 4 files changed, 6 insertions(+), 87 deletions(-) --- diff --git a/python/javapackages/pom/dependency.py b/python/javapackages/pom/dependency.py index 590e1b3..0499b06 100644 --- a/python/javapackages/pom/dependency.py +++ b/python/javapackages/pom/dependency.py @@ -52,6 +52,8 @@ class Dependency(AbstractArtifact): self.optional = optional self.exclusions = exclusions
+ self._root_element_name = "dependency" + def get_xml_element(self, root="dependency"): """ Return XML Element node representation of the Artifact @@ -74,27 +76,6 @@ class Dependency(AbstractArtifact):
return root
- def get_xml_str(self, root="artifact"): - """ - Return XML formatted string representation of the Artifact - """ - return AbstractArtifact.get_xml_str(self, root) - - def __eq__(self, other): - if type(other) is type(self): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other): - return not self.__eq__(other) - - def __hash__(self): - return self.groupId.__hash__() + \ - self.artifactId.__hash__() + \ - self.version.__hash__() + \ - self.extension.__hash__() + \ - self.classifier.__hash__() - @classmethod def from_xml_element(cls, xmlnode): """ diff --git a/python/javapackages/pom/exclusion.py b/python/javapackages/pom/exclusion.py index 14f610c..fe5707a 100644 --- a/python/javapackages/pom/exclusion.py +++ b/python/javapackages/pom/exclusion.py @@ -44,29 +44,7 @@ class Exclusion(AbstractArtifact): self.groupId = groupId.strip() self.artifactId = artifactId.strip()
- def get_xml_element(self, root="exclusion"): - """ - Return XML Element node representation of the Exclusion - """ - return AbstractArtifact.get_xml_element(self, root) - - def get_xml_str(self, root="exclusion"): - """ - Return XML formatted string representation of the Exclusion - """ - return AbstractArtifact.get_xml_str(self, root) - - def __eq__(self, other): - if type(other) is type(self): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other): - return not self.__eq__(other) - - def __hash__(self): - return self.groupId.__hash__() + \ - self.artifactId.__hash__() + self._root_element_name = "exclusion"
@classmethod def from_xml_element(cls, xmlnode): diff --git a/python/javapackages/pom/extension.py b/python/javapackages/pom/extension.py index 672d8a3..4412845 100644 --- a/python/javapackages/pom/extension.py +++ b/python/javapackages/pom/extension.py @@ -44,30 +44,7 @@ class Extension(AbstractArtifact): self.artifactId = artifactId.strip() self.version = version.strip()
- def get_xml_element(self, root="extension"): - """ - Return XML Element node representation of the Extension - """ - return AbstractArtifact.get_xml_element(self, root) - - def get_xml_str(self, root="extension"): - """ - Return XML formatted string representation of the Exclusion - """ - return AbstractArtifact.get_xml_str(self, root) - - def __eq__(self, other): - if type(other) is type(self): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other): - return not self.__eq__(other) - - def __hash__(self): - return self.groupId.__hash__() + \ - self.artifactId.__hash__() + \ - self.version.__hash__() + self._root_element_name = "extension"
@classmethod def from_xml_element(cls, xmlnode): diff --git a/python/javapackages/pom/plugin.py b/python/javapackages/pom/plugin.py index 65e8bef..b2fd42f 100644 --- a/python/javapackages/pom/plugin.py +++ b/python/javapackages/pom/plugin.py @@ -48,6 +48,8 @@ class Plugin(AbstractArtifact): self.version = version.strip() self.dependencies = dependencies
+ self._root_element_name = "plugin" + def get_xml_element(self, root="plugin"): """ Return XML Element node representation of the Plugin @@ -62,25 +64,6 @@ class Plugin(AbstractArtifact):
return root
- def get_xml_str(self, root="plugin"): - """ - Return XML formatted string representation of the Exclusion - """ - return AbstractArtifact.get_xml_str(self, root) - - def __eq__(self, other): - if type(other) is type(self): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other): - return not self.__eq__(other) - - def __hash__(self): - return self.groupId.__hash__() + \ - self.artifactId.__hash__() + \ - self.version.__hash__() - @classmethod def from_xml_element(cls, xmlnode): """