def _parse_circ_entry(entry):
 if ('=' in entry):
  (fingerprint, nickname) = entry.split('=')
 elif ('~' in entry):
  (fingerprint, nickname) = entry.split('~')
 elif (entry[0] == '$'):
  (fingerprint, nickname) = (entry, None)
 else:
  (fingerprint, nickname) = (None, entry)
 if (fingerprint is not None):
  if (not stem.util.tor_tools.is_valid_fingerprint(fingerprint, True)):
   raise stem.ProtocolError(('Fingerprint in the circuit path is malformed (%s)' % fingerprint))
  fingerprint = fingerprint[1:]
 if ((nickname is not None) and (not stem.util.tor_tools.is_valid_nickname(nickname))):
  raise stem.ProtocolError(('Nickname in the circuit path is malformed (%s)' % nickname))
 return (fingerprint, nickname)

def _parse_circ_entry ( entry ) : if ( '=' in entry ) : ( fingerprint , nickname ) = entry . split ( '=' ) elif ( '~' in entry ) : ( fingerprint , nickname ) = entry . split ( '~' ) elif ( entry [ 0 ] == '$' ) : ( fingerprint , nickname ) = ( entry , None ) else : ( fingerprint , nickname ) = ( None , entry ) if ( fingerprint is not None ) : if ( not stem . util . tor_tools . is_valid_fingerprint ( fingerprint , True ) ) : raise stem . ProtocolError ( ( 'Fingerprint in the circuit path is malformed (%s)' % fingerprint ) ) fingerprint = fingerprint [ 1 : ] if ( ( nickname is not None ) and ( not stem . util . tor_tools . is_valid_nickname ( nickname ) ) ) : raise stem . ProtocolError ( ( 'Nickname in the circuit path is malformed (%s)' % nickname ) ) return ( fingerprint , nickname )
parses a single relays longname or serverid .