original_docstring: 
      Duplicate GitHub repos AND their wikis
  
      Parameters
      ----------
      repos: dict of str, str
          GitHub username, reponame to duplicate
      oauth: pathlib.Path
          GitHub Oauth token  https://github.com/settings/tokens
      orgname: str
          create repos under Organization instead of username
      stem: str
          what to start new repo name with
      
docstring: Duplicate GitHub repos AND their wikis
  Parameters
  
  
docstring_tokens: Duplicate GitHub repos AND their wikis Parameters
code: def repo_dupe(repos: dict[str, str], oauth: Path, orgname: str = None, stem: str = ""):
      """
      Duplicate GitHub repos AND their wikis
  
      Parameters
      ----------
      repos: dict of str, str
          GitHub username, reponame to duplicate
      oauth: pathlib.Path
          GitHub Oauth token  https://github.com/settings/tokens
      orgname: str
          create repos under Organization instead of username
      stem: str
          what to start new repo name with
      """
      # %% authenticate
      sess = session(oauth)
      guser = sess.get_user()
  
      org = None
      if orgname:
          assert isinstance(guser, github.AuthenticatedUser.AuthenticatedUser)
          orgs = list(guser.get_orgs())
          for o in orgs:
              if o.login == orgname:
                  org = o
                  break
  
          assert org is not None
          op = org
      else:
          assert isinstance(guser, github.Organization.Organization)
          op = guser
  
      username = op.login
  
      # %% prepare to loop over repos
      for email, oldurl in repos.items():
          check_api_limit(sess)
  
          oldurl = oldurl.replace("https", "ssh")
          oldname = "/".join(oldurl.split("/")[-2:]).split(".")[0]
  
          oldtime = last_commit_date(sess, oldname)
          if oldtime is None:
              continue
  
          mirrorname = stem + email
  
          gitdupe(oldurl, oldtime, username, mirrorname, op)
          gitdupe(oldurl, None, username, mirrorname, op, iswiki=True)
  
          sleep(0.1)
code_tokens: def repo_dupe ( repos : dict [ str , str ] , oauth : Path , orgname : str = None , stem : str = "" ) : sess = session ( oauth ) guser = sess . get_user ( ) org = None if orgname : assert isinstance ( guser , github . AuthenticatedUser . AuthenticatedUser ) orgs = list ( guser . get_orgs ( ) ) for o in orgs : if o . login == orgname : org = o break assert org is not None op = org else : assert isinstance ( guser , github . Organization . Organization ) op = guser username = op . login for email , oldurl in repos . items ( ) : check_api_limit ( sess ) oldurl = oldurl . replace ( "https" , "ssh" ) oldname = "/" . join ( oldurl . split ( "/" ) [ - 2 : ] ) . split ( "." ) [ 0 ] oldtime = last_commit_date ( sess , oldname ) if oldtime is None : continue mirrorname = stem + email gitdupe ( oldurl , oldtime , username , mirrorname , op ) gitdupe ( oldurl , None , username , mirrorname , op , iswiki = True ) sleep ( 0.1 )
short_docstring: Duplicate GitHub repos AND their wikis
  Parameters
short_docstring_tokens: Duplicate GitHub repos AND their wikis Parameters
comment: """
      Duplicate GitHub repos AND their wikis
  
      Parameters
      ----------
      repos: dict of str, str
          GitHub username, reponame to duplicate
      oauth: pathlib.Path
          GitHub Oauth token  https://github.com/settings/tokens
      orgname: str
          create repos under Organization instead of username
      stem: str
          what to start new repo name with
      """$SEP$# %% authenticate$SEP$# %% prepare to loop over repos