Code Duplication    Length = 27-30 lines in 2 locations

tw_serverinfo/game_servers.py 2 locations

@@ 118-147 (lines=30) @@
115
                'ingame': int(slots.popleft().decode('utf-8'))
116
            })
117
118
    @staticmethod
119
    def parse_64_legacy_response(slots: deque, server: GameServer) -> None:
120
        """Parse the 64 slot legacy response
121
122
        :type slots: deque
123
        :type server: GameServer
124
        :return:
125
        """
126
        server.server_type = '64_legacy'
127
        server.version = slots.popleft().decode('utf-8')
128
        server.name = slots.popleft().decode('utf-8')
129
        server.map_name = slots.popleft().decode('utf-8')
130
        server.game_type = slots.popleft().decode('utf-8')
131
        server.flags = int(slots.popleft().decode('utf-8'))
132
        server.num_players = int(slots.popleft().decode('utf-8'))
133
        server.max_players = int(slots.popleft().decode('utf-8'))
134
        server.num_clients = int(slots.popleft().decode('utf-8'))
135
        server.max_clients = int(slots.popleft().decode('utf-8'))
136
137
        if slots[0] == b'':
138
            # no idea what this is, always empty
139
            slots.popleft()
140
141
        while len(slots) >= 5:
142
            server.append_player({
143
                'name': slots.popleft(),
144
                'clan': slots.popleft(),
145
                'country': int(slots.popleft().decode('utf-8')),
146
                'score': int(slots.popleft().decode('utf-8')),
147
                'ingame': int(slots.popleft().decode('utf-8'))
148
            })
149
150
    @staticmethod
@@ 89-115 (lines=27) @@
86
            # extended response (iex+) packet
87
            self.parse_extended_more_response(slots, server)
88
89
    @staticmethod
90
    def parse_vanilla_response(slots: deque, server: GameServer) -> None:
91
        """Parse the default response of the vanilla client
92
93
        :type slots: deque
94
        :type server: GameServer
95
        :return:
96
        """
97
        server.server_type = 'vanilla'
98
        server.version = slots.popleft().decode('utf-8')
99
        server.name = slots.popleft().decode('utf-8')
100
        server.map_name = slots.popleft().decode('utf-8')
101
        server.game_type = slots.popleft().decode('utf-8')
102
        server.flags = int(slots.popleft().decode('utf-8'))
103
        server.num_players = int(slots.popleft().decode('utf-8'))
104
        server.max_players = int(slots.popleft().decode('utf-8'))
105
        server.num_clients = int(slots.popleft().decode('utf-8'))
106
        server.max_clients = int(slots.popleft().decode('utf-8'))
107
108
        while len(slots) >= 5:
109
            # no idea what this is, always empty
110
            server.append_player({
111
                'name': slots.popleft(),
112
                'clan': slots.popleft(),
113
                'country': int(slots.popleft().decode('utf-8')),
114
                'score': int(slots.popleft().decode('utf-8')),
115
                'ingame': int(slots.popleft().decode('utf-8'))
116
            })
117
118
    @staticmethod