aboutsummaryrefslogtreecommitdiffstats
path: root/dlpcvp.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2019-02-19 14:25:10 +0100
committerMatěj Cepl <mcepl@cepl.eu>2019-03-06 13:12:30 +0100
commit6e25d97d3d1cea8f4a5632dc1fdbac214359779d (patch)
tree425491293d93bae36a69942c3f60b8e1361b4700 /dlpcvp.py
parent073609f2db76c08d26b6084427eb4b76c27dda55 (diff)
downloaddlp_check_version_PyPI-6e25d97d3d1cea8f4a5632dc1fdbac214359779d.tar.gz
Correct typos.
Diffstat (limited to 'dlpcvp.py')
-rwxr-xr-xdlpcvp.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/dlpcvp.py b/dlpcvp.py
index 33fec00..fdf6a75 100755
--- a/dlpcvp.py
+++ b/dlpcvp.py
@@ -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))
-