Returns the encoded bytes of tokens and notifications
  
        tokens          a list of tokens or a string of only one token
        notifications   a list of notifications or a dictionary of only one
542537
def encode_notifications(tokens, notifications):
  
  
  fmt = "!BH32sH%ds"
  structify = lambda t, p: struct.pack(fmt % len(p), 0, 32, t, len(p), p)
  binaryify = lambda t: t.decode('hex')
  if type(notifications) is dict and type(tokens) in (str, unicode):
    tokens, notifications = ([tokens], [notifications])
  if type(notifications) is list and type(tokens) is list:
    return ''.join(map(lambda y: structify(*y), ((binaryify(t), json.dumps(p, separators=(',',':'), ensure_ascii=False).encode('utf-8'))
                                    for t, p in zip(tokens, notifications))))
1071208
def _as_decode(self, msg):
        """"""
        return {'armed_statuses': [x for x in msg[4:12]],
                'arm_up_states': [x for x in msg[12:20]],
                'alarm_states': [x for x in msg[20:28]]}
232305
function readNotifyUserHeaders(message, tokens) {
	var i;
	message.headers = {};
	for (i = 0; i < tokens.length; i = i + 4) {
		message.headers[protocol.decodeString(tokens[i + 1])] = protocol.decodeString(tokens[i + 3]);
	}
}
6008
def decode(tokens):
  
  token_is_alnum = [t[0] in _ALPHANUMERIC_CHAR_SET for t in tokens]
  ret = []
  for i, token in enumerate(tokens):
    if i > 0 and token_is_alnum[i - 1] and token_is_alnum[i]:
      ret.append(u" ")
    ret.append(token)
  return "".join(ret)
309775
def get_feedback
      tokens = []

      begin
        setup_ssl(true)
      rescue SocketError => e
        puts "Error: #{e}"
        return tokens
      end

      if IO.select([@ssl], nil, nil, 1)
        while (line = @ssl.read(38))
          f = line.unpack('N1n1H64')
          time = Time.at(f[0])
          token = f[2].scan(/.{8}/).join(' ')
          tokens << token
        end
      end

      close_ssl

      return tokens
    end
827901
def _decode_token_json(token):
    
    header, payload, raw_signatures, signing_inputs = _unpack_token_json(token)
    token = {
        'header': header,
        'payload': payload,
        'signature': [base64url_encode(rs) for rs in raw_signatures]
    }
    return token
693198
function readNotifyUserAuth(message, tokens) {
	message.userName = protocol.decodeString(tokens[1]);
	message.userPassword = protocol.decodeString(tokens[3]);
	message.clientPrincipal = protocol.decodeString(tokens[5]);
	readNotifyUserHeaders(message, tokens.slice(6));
}
750218
def notifications(self):
        
        if self._notifications is None:
            self._notifications = NotificationList(self._version, account_sid=self._solution['sid'], )
        return self._notifications
1011697
def info(self, token):
        
        _res = dict(zip(['_id', 'type', 'sid', 'exp'],
                        self.split_token(token)))
        if _res['type'] != self.type:
            raise WrongTokenType(_res['type'])
        else:
            _res['handler'] = self
            _res['black_listed'] = self.is_black_listed(token)
            return _res
77546
def get_notifications(self, new=True):
        """"""
        url = (self._imgur._base_url + "/3/account/{0}/"
               "notifications".format(self.name))
        resp = self._imgur._send_request(url, params=locals(), needs_auth=True)
        msgs = [Message(msg_dict, self._imgur, has_fetched=True) for msg_dict
                in resp['messages']]
        replies = [Comment(com_dict, self._imgur, has_fetched=True) for
                   com_dict in resp['replies']]
        return {'messages': msgs, 'replies': replies}
1036274
def assemble_notification_request(method, params=tuple()):
        
        if not isinstance(method, (str, unicode)):
            raise TypeError('"method" must be a string (or unicode string).')
        if not isinstance(params, (tuple, list)):
            raise TypeError("params must be a tuple/list.")

        return {
            "method": method,
            "params": params,
            "id": None
        }
233232
def _get_tokens_dict(self):
        
        if self._tokens_dict is None:
            tokens = [Token(element) for element in self._element.xpath('tokens/token')]
            self._tokens_dict = OrderedDict([(t.id, t) for t in tokens])
        return self._tokens_dict
140579
def decode(self, data, password):
		
		self.raw = gntp.shim.u(data)
		parts = self.raw.split('\r\n\r\n')
		self.info = self._parse_info(self.raw)
		self._validate_password(password)
		self.headers = self._parse_dict(parts[0])

		for i, part in enumerate(parts):
			if i == 0:
				continue  # Skip Header
			if part.strip() == '':
				continue
			notice = self._parse_dict(part)
			if notice.get('Notification-Name', False):
				self.notifications.append(notice)
			elif notice.get('Identifier', False):
				notice['Data'] = self._decode_binary(part, notice)
				#open('register.png','wblol').write(notice['Data'])
				self.resources[notice.get('Identifier')] = notice
465508
def headers(self):
        
        d = {}
        for k, v in self.message.items():
            d[k] = decode_header_part(v)
        return d
111323
def from_message(cls, message='> '):
        
        assert isinstance(message, text_type)

        def get_message_tokens(cli):
            return [(Token.Prompt, message)]
        return cls(get_message_tokens)
533430
def get_notifications(self, login=None, **kwargs):
        

        _login = kwargs.get(
            'login',
            login or self._login
        )
        _notif_url = NOTIF_URL.format(login=_login)
        return self._request_api(url=_notif_url).json()
1188083
def identify(self, token):
        

        payload = {
            'op': 2,
            'd': {
                'token': self.token,
                'properties': {
                    '$os': sys.platform,
                    '$browser': 'legobot',
                    '$device': 'legobot'
                },
                'compress': False,
                'large_threshold': 250
            }
        }
        payload['d']['synced_guilds'] = []
        logger.info("Identifying with the following message: \
                    {}".format(payload))
        self.ws.send(json.dumps(payload))
        return