From 8ce52c0f923472c419984dc7d0606bd2042b96f1 Mon Sep 17 00:00:00 2001 From: Mousa Zeid Baker Date: Thu, 14 Oct 2021 23:10:52 +0200 Subject: [PATCH 1/3] compile regex pattern once before matching --- src/poetryup/poetryup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/poetryup/poetryup.py b/src/poetryup/poetryup.py index b6832d3..886c67a 100644 --- a/src/poetryup/poetryup.py +++ b/src/poetryup/poetryup.py @@ -55,9 +55,10 @@ def _list_dependencies() -> List[Dependency]: output = _run_poetry_show() + pattern = re.compile("^[a-zA-Z]+") dependencies: List[Dependency] = [] for line in output.split("\n"): - if re.match("^[a-zA-Z]+", line) is not None: + if pattern.match(line) is not None: name, version, *_ = line.split() dependency = Dependency(name=name, version=version) dependencies.append(dependency) From cfda7ba6df7b5c24287512922c88f4326e33450c Mon Sep 17 00:00:00 2001 From: Mousa Zeid Baker Date: Thu, 14 Oct 2021 23:11:23 +0200 Subject: [PATCH 2/3] update regex pattern --- src/poetryup/poetryup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/poetryup/poetryup.py b/src/poetryup/poetryup.py index 886c67a..9c4cb01 100644 --- a/src/poetryup/poetryup.py +++ b/src/poetryup/poetryup.py @@ -55,7 +55,7 @@ def _list_dependencies() -> List[Dependency]: output = _run_poetry_show() - pattern = re.compile("^[a-zA-Z]+") + pattern = re.compile("^[a-zA-Z-]+") dependencies: List[Dependency] = [] for line in output.split("\n"): if pattern.match(line) is not None: From 16156014a236229821de73f34cce4fc9b7485022 Mon Sep 17 00:00:00 2001 From: Mousa Zeid Baker Date: Thu, 14 Oct 2021 23:12:10 +0200 Subject: [PATCH 3/3] bump project version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c6fa326..67a2a52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetryup" -version = "0.3.6" +version = "0.3.7" description = "Update dependencies and bump their version in the pyproject.toml file" authors = ["Mousa Zeid Baker"] packages = [