def __init__(self, data=None, url=None, file=None,<EOL>version=None, revision=None, metric=None,<EOL>timeout=None, verify=True, directed=False):  
if version:<EOL><INDENT>self.version = version<EOL><DEDENT>if revision:<EOL><INDENT>self.revision = revision<EOL><DEDENT>if metric:<EOL><INDENT>self.metric = metric<EOL><DEDENT>self.timeout = timeout<EOL>self.verify = verify<EOL>self.directed = directed<EOL>if data is None and url is not None:<EOL><INDENT>data = self._get_url(url)<EOL><DEDENT>elif data is None and file is not None:<EOL><INDENT>data = self._get_file(file)<EOL><DEDENT>elif data is None and url is None and file is None:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>self.original_data = self.to_python(data)<EOL>if self.__class__ is not BaseParser:<EOL><INDENT>self.graph = self.parse(self.original_data)<EOL><DEDENT>
Initializes a new Parser

:param data: ``str`` or ``dict`` containing topology data
:param url: HTTP URL to retrieve topology data
:param file: path to file containing topology data
:param version: routing protocol version
:param revision: routing protocol revision
:param metric: routing protocol metric
:param timeout: timeout in seconds for HTTP or telnet requests
:param verify: boolean (valid for HTTPS requests only)
:param directed: whether the resulting graph should be directed
                 (undirected by default for backwards compatibility)