vimPlugins: fix formatting and typing in update.py
This commit is contained in:
parent
1b53f78ef5
commit
61c60bad22
@ -25,9 +25,9 @@ from typing import Dict, List, Optional, Tuple, Union, Any
|
|||||||
from urllib.parse import urljoin, urlparse
|
from urllib.parse import urljoin, urlparse
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
ATOM_ENTRY = "{http://www.w3.org/2005/Atom}entry"
|
ATOM_ENTRY = "{http://www.w3.org/2005/Atom}entry" # " vim gets confused here
|
||||||
ATOM_LINK = "{http://www.w3.org/2005/Atom}link"
|
ATOM_LINK = "{http://www.w3.org/2005/Atom}link" # "
|
||||||
ATOM_UPDATED = "{http://www.w3.org/2005/Atom}updated"
|
ATOM_UPDATED = "{http://www.w3.org/2005/Atom}updated" # "
|
||||||
|
|
||||||
ROOT = Path(__file__).parent
|
ROOT = Path(__file__).parent
|
||||||
DEFAULT_IN = ROOT.joinpath("vim-plugin-names")
|
DEFAULT_IN = ROOT.joinpath("vim-plugin-names")
|
||||||
@ -69,7 +69,7 @@ class Repo:
|
|||||||
updated_tag is not None and updated_tag.text is not None
|
updated_tag is not None and updated_tag.text is not None
|
||||||
), f"No updated tag found feed entry {xml}"
|
), f"No updated tag found feed entry {xml}"
|
||||||
updated = datetime.strptime(updated_tag.text, "%Y-%m-%dT%H:%M:%SZ")
|
updated = datetime.strptime(updated_tag.text, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
return Path(url.path).name, updated
|
return Path(str(url.path)).name, updated
|
||||||
|
|
||||||
def prefetch_git(self, ref: str) -> str:
|
def prefetch_git(self, ref: str) -> str:
|
||||||
data = subprocess.check_output(
|
data = subprocess.check_output(
|
||||||
@ -210,20 +210,17 @@ def check_results(
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def parse_plugin_line(line: str) -> Tuple[str, str, str]:
|
def parse_plugin_line(line: str) -> Tuple[str, str, Optional[str]]:
|
||||||
|
name, repo = line.split("/")
|
||||||
try:
|
try:
|
||||||
name, repo = line.split("/")
|
repo, alias = repo.split(" as ")
|
||||||
try:
|
return (name, repo, alias.strip())
|
||||||
repo, alias = repo.split(" as ")
|
|
||||||
return (name, repo, alias.strip())
|
|
||||||
except ValueError:
|
|
||||||
# no alias defined
|
|
||||||
return (name, repo.strip(), None)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return (None, None, None)
|
# no alias defined
|
||||||
|
return (name, repo.strip(), None)
|
||||||
|
|
||||||
|
|
||||||
def load_plugin_spec(plugin_file: str) -> List[Tuple[str, str]]:
|
def load_plugin_spec(plugin_file: str) -> List[Tuple[str, str, Optional[str]]]:
|
||||||
plugins = []
|
plugins = []
|
||||||
with open(plugin_file) as f:
|
with open(plugin_file) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
@ -385,7 +382,7 @@ def main() -> None:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# synchronous variant for debugging
|
# synchronous variant for debugging
|
||||||
# results = map(prefetch_with_cache, plugins)
|
# results = list(map(prefetch_with_cache, plugin_names))
|
||||||
pool = Pool(processes=30)
|
pool = Pool(processes=30)
|
||||||
results = pool.map(prefetch_with_cache, plugin_names)
|
results = pool.map(prefetch_with_cache, plugin_names)
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user