Check current saved options and unset if repos not present.

@param array $ghu_options_keys
@param array $ghu_tokens
558619
public function unset_stale_options( $ghu_options_keys, $ghu_tokens ) {
		$running_servers = $this->get_running_git_servers();
		$ghu_unset_keys  = array_diff_key( static::$options, $ghu_options_keys );
		$always_unset    = [
			'db_version',
			'branch_switch',
			'github_access_token',
			'github_enterprise_token',
		];

		if ( in_array( 'bitbucket', $running_servers, true ) ) {
			$always_unset = array_merge(
				$always_unset,
				[
					'bitbucket_username',
					'bitbucket_password',
				]
			);
		}

		if ( in_array( 'bbserver', $running_servers, true ) ) {
			$always_unset = array_merge(
				$always_unset,
				[
					'bitbucket_server_username',
					'bitbucket_server_password',
				]
			);
		}

		array_map(
			function ( $e ) use ( &$ghu_unset_keys ) {
				unset( $ghu_unset_keys[ $e ] );
			},
			$always_unset
		);

		$auth_required       = static::$auth_required;
		$auth_required_unset = [
			'github_enterprise' => 'github_enterprise_token',
			'gitlab'            => 'gitlab_access_token',
			'gitlab_enterprise' => 'gitlab_enterprise_token',
			'gitea'             => 'gitea_access_token',
		];

		array_map(
			function ( $e ) use ( &$ghu_unset_keys, $auth_required, $auth_required_unset ) {
				$key = array_search( $e, $auth_required_unset, true );
				if ( $auth_required[ $key ] ) {
					unset( $ghu_unset_keys[ $e ] );
				}
			},
			$auth_required_unset
		);

		// Unset if current_branch AND if associated with repo.
		array_map(
			function ( $e ) use ( &$ghu_unset_keys, $ghu_tokens, &$reset_keys ) {
				$key  = array_search( $e, $ghu_unset_keys, true );
				$repo = str_replace( 'current_branch_', '', $key );
				if ( array_key_exists( $key, $ghu_unset_keys )
				&& false !== strpos( $key, 'current_branch' )
				) {
					unset( $ghu_unset_keys[ $key ] );
				}
				if ( ! array_key_exists( $repo, $ghu_tokens ) ) {
					$reset_keys[ $key ] = $e;
				}
			},
			$ghu_unset_keys
		);
		$ghu_unset_keys = array_merge( $ghu_unset_keys, (array) $reset_keys );

		if ( ! empty( $ghu_unset_keys ) ) {
			foreach ( $ghu_unset_keys as $key => $value ) {
				unset( static::$options[ $key ] );
			}
			update_site_option( 'github_updater', static::$options );
		}
	}
1055743
function(tokens) {
      tokensObj = tokens;

      if (tokens === null) {
        storage.remove(tokensKey);
      } else {
        storage.set(tokensKey, tokens);
      }
    }
1239136
def build_from_issues(gh_token, body):
    
    if body["action"] in ["opened", "edited"]:
        github_con = Github(gh_token)
        repo = github_con.get_repo(body['repository']['full_name'])
        issue = repo.get_issue(body['issue']['number'])
        text = body['issue']['body']
        comment = issue  # It's where we update the comment: in the issue itself
        return WebhookMetadata(repo, issue, text, comment)
    return None
1038677
public function deleteToken(TokenUUID $tokenUUID)
    {
        $this->load();
        parent::deleteToken($tokenUUID);
        $this->save();
    }
273657
async function gitStashSave(options) {
  debug('Stashing files...')
  // Save ref to the current index
  indexTree = await writeTree(options)
  // Add working copy changes to index
  await execGit(['add', '.'], options)
  // Save ref to the working copy index
  workingCopyTree = await writeTree(options)
  // Restore the current index
  await execGit(['read-tree', indexTree], options)
  // Remove all modifications
  await execGit(['checkout-index', '-af'], options)
  // await execGit(['clean', '-dfx'], options)
  debug('Done stashing files!')
  return [workingCopyTree, indexTree]
}
1207472
def undo(ui, repo, clname, **opts):
	
	if repo[None].branch() != "default":
		raise hg_util.Abort("cannot run hg undo outside default branch")
	err = clpatch_or_undo(ui, repo, clname, opts, mode="undo")
	if err:
		raise hg_util.Abort(err)
540463
protected static function processUnlimitedOption(array &$options, $key)
    {
        $ukey = "u{$key}";
        unset($options[$ukey]);
        if (array_key_exists($key, $options) && ($options[$key] === 'unlimited' || !isset($options[$key]))) {
            $options[$ukey] = 'ON';
        }
    }
1037551
protected function separateActiveAndInactiveTokens(array $tokens)
    {
        if ($this->request === null) {
            return;
        }

        /** @var $token TokenInterface */
        foreach ($tokens as $token) {
            if ($this->isTokenActive($token)) {
                $this->activeTokens[$token->getAuthenticationProviderName()] = $token;
            } else {
                $this->inactiveTokens[$token->getAuthenticationProviderName()] = $token;
            }
        }
    }
773155
protected function checkToken($xml){
        if ($xml && $xml->NextToken && (string)$xml->HasNext != 'false' && (string)$xml->MoreResultsAvailable != 'false'){
            $this->tokenFlag = true;
            $this->options['NextToken'] = (string)$xml->NextToken;
        } else {
            unset($this->options['NextToken']);
            $this->tokenFlag = false;
        }
    }
1286009
public void checkLock(Session session, String path, List<String> tokens) throws LockException
   {
      String repoPath = session.getRepository().hashCode() + "/" + session.getWorkspace().getName() + "/" + path;

      String currentToken = nullResourceLocks.get(repoPath);

      if (currentToken == null)
      {
         return;
      }

      if (tokens != null)
      {
         for (String token : tokens)
         {
            if (token.equals(currentToken))
            {
               return;
            }
         }
      }

      throw new LockException("Resource already locked " + repoPath);
   }
507753
protected static function checkOptions(array $options)
    {
        if (isset($options['value'])) {
            $value = $options['value'];
            unset($options['value']);
            $options['value'] = $value;
        }

        return $options;
    }
1031177
def remove_repositories(repositories, default_repositories):
    
    repos = []
    for repo in repositories:
        if repo in default_repositories:
            repos.append(repo)
    return repos
820435
function validGh (opts) {
  if (!opts.ghrelease) {
    return Promise.resolve(true)
  }

  if (!opts.ghtoken) {
    return Promise.reject(new Error('Missing GitHub access token. ' +
                                    'Have you set `AEGIR_GHTOKEN`?'))
  }
  return Promise.resolve()
}
584430
protected function mergeStabilityFlags(
        RootPackageInterface $root,
        array $requires
    ) {
        $flags = $root->getStabilityFlags();
        $sf = new StabilityFlags($flags, $root->getMinimumStability());

        $unwrapped = self::unwrapIfNeeded($root, 'setStabilityFlags');
        $unwrapped->setStabilityFlags(array_merge(
            $flags,
            $sf->extractAll($requires)
        ));
    }
1105039
def check_option_validity
      if @hold && !@array_names.empty?
        puts "ERROR: Holding of array objects is not yet supported"
        exit 1
      end

      if @tags.empty? and @array_names.empty? and @deployment_names.empty? and not @chimpd_wait_until_done
        puts "ERROR: Please select the objects to operate upon."
        help
        exit 1
      end

      if not @array_names.empty? and ( not @tags.empty? or not @deployment_names.empty? )
        puts "ERROR: You cannot mix ServerArray queries with other types of queries."
        help
        exit 1
      end
    end
1286028
public function checkAccessToken($access_token = null)
    {
        $token = is_null($access_token) ? $this->access_token : $access_token;
        if (is_null($token)) return false;

        $rs = $this->api('getUserSettings', array('access_token' => $token));
        return isset($rs['response']);
    }
349747
protected function resetSkus(){
        foreach($this->options as $op=>$junk){
            if(preg_match("#SellerSkus.member.#",$op)){
                unset($this->options[$op]);
            }
        }
    }