1
0
mirror of https://github.com/adlerosn/rede-especificacoes-tecnicas-em-redes synced 2024-07-08 18:20:13 +00:00
ufes-mestrado-projetopesqui.../docRefNetCreator/documents/__init__.py
2019-04-17 11:09:38 -03:00

31 lines
582 B
Python

#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from .document import Document
from .pdfreader import PdfReader
from typing import Optional
from typing import Type
readers = [
PdfReader
]
def fromExtension(ext: str) -> Optional[Type[Document]]:
for reader in readers:
if ext in reader._opens():
return reader
return None
def fromFile(path: str) -> Optional[Document]:
document = fromExtension(path.split('.')[-1])
return None if document is None else document(path)
__all__ = [
'Document',
'fromExtension',
'fromFile',
]