Detect Python code duplicate

You can detect Python code duplicate with Pylint

pylint --disable=all --enable=duplicate-code src/

No config file found, using default configuration
************* Module gns3server.compute.dynamips.nodes.ethernet_switch
R:  1, 0: Similar lines in 2 files
==gns3server.compute.dynamips.nodes.ethernet_hub:101
==gns3server.compute.dynamips.nodes.ethernet_switch:136
    @property
    def mappings(self):
        """
        Returns port mappings

        :returns: mappings list
        """

        return self._mappings

    @asyncio.coroutine
    def delete(self):
        return (yield from self.close())

    @asyncio.coroutine
    def close(self):
        """
        Deletes this hub.
        """
 (duplicate-code)
R:  1, 0: Similar lines in 2 files
==gns3server.compute.dynamips.nodes.ethernet_hub:66
==gns3server.compute.dynamips.nodes.ethernet_switch:72
    @property
    def ports_mapping(self):
        """
        Ports on this hub

        :returns: ports info
        """

        return self._ports

    @ports_mapping.setter
    def ports_mapping(self, ports):
        """
        Set the ports on this hub

        :param ports: ports info
        """
        if ports != self._ports: (duplicate-code)

Report
======
231 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |2      |NC         |NC         |NC          |NC       |
+---------+-------+-----------+-----------+------------+---------+
|class    |2      |NC         |NC         |NC          |NC       |
+---------+-------+-----------+-----------+------------+---------+
|method   |0      |NC         |NC         |0           |0        |
+---------+-------+-----------+-----------+------------+---------+
|function |0      |NC         |NC         |0           |0        |
+---------+-------+-----------+-----------+------------+---------+



Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |304    |48.95 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |167    |26.89 |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |34     |5.48  |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |116    |18.68 |NC       |NC         |
+----------+-------+------+---------+-----------+



Duplication
-----------

+-------------------------+-------+---------+-----------+
|                         |now    |previous |difference |
+=========================+=======+=========+===========+
|nb duplicated lines      |87     |NC       |NC         |
+-------------------------+-------+---------+-----------+
|percent duplicated lines |14.100 |NC       |NC         |
+-------------------------+-------+---------+-----------+



Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |0      |NC       |NC         |
+-----------+-------+---------+-----------+
|refactor   |7      |NC       |NC         |
+-----------+-------+---------+-----------+
|warning    |0      |NC       |NC         |
+-----------+-------+---------+-----------+
|error      |0      |NC       |NC         |
+-----------+-------+---------+-----------+



% errors / warnings by module
-----------------------------

+--------------------------------------------------+------+--------+---------+-----------+
|module                                            |error |warning |refactor |convention |
+==================================================+======+========+=========+===========+
|gns3server.compute.dynamips.nodes.ethernet_switch |0.00  |0.00    |100.00   |0.00       |
+--------------------------------------------------+------+--------+---------+-----------+



Messages
--------

+---------------+------------+
|message id     |occurrences |
+===============+============+
|duplicate-code |7           |
+---------------+------------+



Global evaluation
-----------------
Your code has been rated at 9.70/10