osanseviero commited on
Commit
fc6513b
1 Parent(s): 3b2d079

Update src/distilabel_dataset_generator/utils.py

Browse files
src/distilabel_dataset_generator/utils.py CHANGED
@@ -48,17 +48,16 @@ def get_duplicate_button():
48
 
49
 
50
  def list_orgs(token: OAuthToken = None):
51
- if token is not None:
52
- data = whoami(token)
53
- organisations = [
54
- entry["entity"]["name"]
55
- for entry in data["auth"]["accessToken"]["fineGrained"]["scoped"]
56
- if "repo.write" in entry["permissions"]
57
- ]
58
- organisations.append(data["name"])
59
- return list(set(organisations))
60
- else:
61
  return []
 
 
 
 
 
 
 
 
62
 
63
 
64
  def get_org_dropdown(token: OAuthToken = None):
 
48
 
49
 
50
  def list_orgs(token: OAuthToken = None):
51
+ if oauth_token is None:
 
 
 
 
 
 
 
 
 
52
  return []
53
+ data = whoami(token.token)
54
+ organisations = [
55
+ entry["entity"]["name"]
56
+ for entry in data["auth"]["accessToken"]["fineGrained"]["scoped"]
57
+ if "repo.write" in entry["permissions"]
58
+ ]
59
+ organisations.append(data["name"])
60
+ return list(set(organisations))
61
 
62
 
63
  def get_org_dropdown(token: OAuthToken = None):