diff options
-rwxr-xr-x | dlpcvp.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -7,11 +7,11 @@ import os.path as osp import sqlite3 import sys import urllib.request +import xml.etree.ElementTree as ET from distutils.version import LooseVersion +from typing import Iterable, List, Optional, Tuple, Union from urllib.error import HTTPError from urllib.request import Request, urlopen -from typing import Iterable, List, Optional, Tuple -import xml.etree.ElementTree as ET # PyPI API documentation https://warehouse.readthedocs.io/api-reference/ @@ -31,7 +31,7 @@ config = configparser.ConfigParser() config.read(ConfigRCs) logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', - stream=sys.stdout, level=logging.INFO) + stream=sys.stdout, level=logging.DEBUG) log = logging.getLogger() # or HTTPPasswordMgrWithPriorAuth ? @@ -115,7 +115,7 @@ def update_etags(con: sqlite3.Connection, pkg: str, con.commit() -def parse_spec(spec_file: str, pkg: str) -> LooseVersion: +def parse_spec(spec_file: Union[str, bytes]) -> LooseVersion: if isinstance(spec_file, bytes): spec_file = spec_file.decode() @@ -128,7 +128,7 @@ def parse_spec(spec_file: str, pkg: str) -> LooseVersion: return LooseVersion(rest_of_line) -def get_spec_name(req: Request, proj: str, pkg: str, etag: str = None) -> OStr: +def get_spec_name(req: Request, proj: str, pkg: str, etag: OStr = None) -> OStr: """Acquire version from the listing of the project directory. """ spec_files = [] # type: List[str] @@ -290,4 +290,3 @@ if __name__ == '__main__': args = parser.parse_args() sys.exit(main(args.project)) - |