saridormi commited on
Commit
1a033b9
1 Parent(s): 338ab1d

Fix more issues with repo type

Browse files
Files changed (1) hide show
  1. src/submission_uploader.py +5 -2
src/submission_uploader.py CHANGED
@@ -29,7 +29,9 @@ class SubmissionUploader:
29
  def _get_previous_pr(self, pr_title: str) -> Optional[Discussion]:
30
  """Searches among discussions of dataset repo for a PR with the given title."""
31
  try:
32
- discussions = self._api.get_repo_discussions(repo_id=self._dataset_id)
 
 
33
  except Exception:
34
  return None
35
  for discussion in discussions:
@@ -111,7 +113,7 @@ class SubmissionUploader:
111
 
112
  prev_pr = self._get_previous_pr(pr_title)
113
  if prev_pr is not None:
114
- url = f"https://huggingface.co/{self._dataset_id}/discussions/{prev_pr.num}"
115
  raise AlreadyExists(
116
  f"{self._dataset_id} already has an open PR for this submission: {url}."
117
  )
@@ -140,6 +142,7 @@ class SubmissionUploader:
140
  * Submitted By: {submitted_by}
141
  """,
142
  create_pr=True,
 
143
  )
144
  logging.info(f"PR created at {new_pr.pr_url}")
145
 
 
29
  def _get_previous_pr(self, pr_title: str) -> Optional[Discussion]:
30
  """Searches among discussions of dataset repo for a PR with the given title."""
31
  try:
32
+ discussions = self._api.get_repo_discussions(
33
+ repo_id=self._dataset_id, repo_type="dataset"
34
+ )
35
  except Exception:
36
  return None
37
  for discussion in discussions:
 
113
 
114
  prev_pr = self._get_previous_pr(pr_title)
115
  if prev_pr is not None:
116
+ url = f"https://huggingface.co/datasets/{self._dataset_id}/discussions/{prev_pr.num}"
117
  raise AlreadyExists(
118
  f"{self._dataset_id} already has an open PR for this submission: {url}."
119
  )
 
142
  * Submitted By: {submitted_by}
143
  """,
144
  create_pr=True,
145
+ repo_type="dataset",
146
  )
147
  logging.info(f"PR created at {new_pr.pr_url}")
148