def decode_methods_request(offset, data):
 if ((len(data) - offset) < 2):
  return (offset, None)
 (version, number_of_methods) = struct.unpack_from('!BB', data, offset)
 if (not (version == SOCKS_VERSION)):
  return (offset, None)
 offset += 2
 methods = set([])
 for i in range(number_of_methods):
  (method,) = struct.unpack_from('!B', data, offset)
  methods.add(method)
  offset += 1
 return (offset, MethodRequest(version, methods))

def decode_methods_request ( offset , data ) : if ( ( len ( data ) - offset ) < 2 ) : return ( offset , None ) ( version , number_of_methods ) = struct . unpack_from ( '!BB' , data , offset ) if ( not ( version == SOCKS_VERSION ) ) : return ( offset , None ) offset += 2 methods = set ( [ ] ) for i in range ( number_of_methods ) : ( method , ) = struct . unpack_from ( '!B' , data , offset ) methods . add ( method ) offset += 1 return ( offset , MethodRequest ( version , methods ) )
try to decodes a method request .