anzorq commited on
Commit
210483c
1 Parent(s): 65ebbd2

Update hf_utils.py

Browse files
Files changed (1) hide show
  1. hf_utils.py +14 -1
hf_utils.py CHANGED
@@ -34,4 +34,17 @@ def delete_file(revision: str):
34
  Returns:
35
  None
36
  """
37
- scan_cache_dir().delete_revisions(revision).execute()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  Returns:
35
  None
36
  """
37
+ scan_cache_dir().delete_revisions(revision).execute()
38
+
39
+ def get_pr_url(api, repo_id, title):
40
+ try:
41
+ discussions = api.get_repo_discussions(repo_id=repo_id)
42
+ except Exception:
43
+ return None
44
+ for discussion in discussions:
45
+ if (
46
+ discussion.status == "open"
47
+ and discussion.is_pull_request
48
+ and discussion.title == title
49
+ ):
50
+ return f"https://huggingface.co/{repo_id}/discussions/{discussion.num}"