Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Sep 8, 2023
1 parent f96752c commit 122c8c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ mypy:

.PHONY: black
black:
@black $(FILES)
@black --check $(FILES)
32 changes: 14 additions & 18 deletions bugme.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,21 @@ def get_item(string: str) -> Union[Item, None]:
string = string if string.startswith("https://") else f"https://{string}"
url = urlparse(string)
assert url.hostname is not None
repo: str = ""
if url.hostname.startswith("git"):
return Item(
host=url.hostname,
repo=os.path.dirname(
os.path.dirname(url.path.replace("/-/", "/"))
).lstrip("/"),
issue_id=int(os.path.basename(url.path)),
)
if url.hostname.startswith("bugzilla"):
return Item(
host=url.hostname,
issue_id=int(parse_qs(url.query)["id"][0]),
)
if url.hostname == "progress.opensuse.org":
return Item(
host=url.hostname,
issue_id=int(os.path.basename(url.path)),
)
return None
repo = os.path.dirname(
os.path.dirname(url.path.replace("/-/", "/"))
).lstrip("/")
issue_id = os.path.basename(url.path)
elif url.hostname.startswith("bugzilla"):
issue_id = parse_qs(url.query)["id"][0]
elif url.hostname == "progress.opensuse.org":
issue_id = os.path.basename(url.path)
return Item(
host=url.hostname,
repo=repo,
issue_id=int(issue_id),
)
if string.startswith(("bnc#", "boo#", "bsc#")):
return Item(host="bugzilla.suse.de", issue_id=int(string.split("#", 1)[1]))
if string.startswith("poo#"):
Expand Down

0 comments on commit 122c8c1

Please sign in to comment.