Checks if the unit is an SCV that is currently building.
11829
def is_constructing_scv(self) -> bool:
        
        return self.orders and self.orders[0].ability.id in {
            AbilityId.TERRANBUILD_ARMORY,
            AbilityId.TERRANBUILD_BARRACKS,
            AbilityId.TERRANBUILD_BUNKER,
            AbilityId.TERRANBUILD_COMMANDCENTER,
            AbilityId.TERRANBUILD_ENGINEERINGBAY,
            AbilityId.TERRANBUILD_FACTORY,
            AbilityId.TERRANBUILD_FUSIONCORE,
            AbilityId.TERRANBUILD_GHOSTACADEMY,
            AbilityId.TERRANBUILD_MISSILETURRET,
            AbilityId.TERRANBUILD_REFINERY,
            AbilityId.TERRANBUILD_SENSORTOWER,
            AbilityId.TERRANBUILD_STARPORT,
            AbilityId.TERRANBUILD_SUPPLYDEPOT,
        }
1330525
function determineIfIncluded(conn, earlier_unit, arrLaterUnits, handleResult){
//	console.log('determineIfIncluded', earlier_unit, arrLaterUnits, new Error().stack);
	if (!earlier_unit)
		throw Error("no earlier_unit");
	if (storage.isGenesisUnit(earlier_unit))
		return handleResult(true);
	storage.readPropsOfUnits(conn, earlier_unit, arrLaterUnits, function(objEarlierUnitProps, arrLaterUnitProps){
		if (objEarlierUnitProps.is_free === 1)
			return handleResult(false);
		
		var max_later_limci = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.latest_included_mc_index; }));
		//console.log("max limci "+max_later_limci+", earlier mci "+objEarlierUnitProps.main_chain_index);
		if (objEarlierUnitProps.main_chain_index !== null && max_later_limci >= objEarlierUnitProps.main_chain_index)
			return handleResult(true);
		if (max_later_limci < objEarlierUnitProps.latest_included_mc_index)
			return handleResult(false);
		
		var max_later_level = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.level; }));
		if (max_later_level < objEarlierUnitProps.level)
			return handleResult(false);
		
		var max_later_wl = Math.max.apply(
			null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.witnessed_level; }));
		if (max_later_wl < objEarlierUnitProps.witnessed_level && objEarlierUnitProps.main_chain_index > constants.witnessedLevelMustNotRetreatFromAllParentsUpgradeMci)
			return handleResult(false);
		
		var bAllLaterUnitsAreWithMci = !arrLaterUnitProps.find(function(objLaterUnitProps){ return (objLaterUnitProps.main_chain_index === null); });
		if (bAllLaterUnitsAreWithMci){
			if (objEarlierUnitProps.main_chain_index === null){
				console.log('all later are with mci, earlier is null mci', objEarlierUnitProps, arrLaterUnitProps);
				return handleResult(false);
			}
			var max_later_mci = Math.max.apply(
				null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.main_chain_index; }));
			if (max_later_mci < objEarlierUnitProps.main_chain_index)
				return handleResult(false);
		}
		
		var arrKnownUnits = [];
		
		function goUp(arrStartUnits){
		//	console.log('determine goUp', earlier_unit, arrLaterUnits/*, arrStartUnits*/);
			arrKnownUnits = arrKnownUnits.concat(arrStartUnits);
			var arrDbStartUnits = [];
			var arrParents = [];
			arrStartUnits.forEach(function(unit){
				var props = storage.assocUnstableUnits[unit] || storage.assocStableUnits[unit];
				if (!props || !props.parent_units){
					arrDbStartUnits.push(unit);
					return;
				}
				props.parent_units.forEach(function(parent_unit){
					var objParent = storage.assocUnstableUnits[parent_unit] || storage.assocStableUnits[parent_unit];
					if (!objParent){
						if (arrDbStartUnits.indexOf(unit) === -1)
							arrDbStartUnits.push(unit);
						return;
					}
					/*objParent = _.cloneDeep(objParent);
					for (var key in objParent)
						if (['unit', 'level', 'latest_included_mc_index', 'main_chain_index', 'is_on_main_chain'].indexOf(key) === -1)
							delete objParent[key];*/
					arrParents.push(objParent);
				});
			});
			if (arrDbStartUnits.length > 0){
				console.log('failed to find all parents in memory, will query the db, earlier '+earlier_unit+', later '+arrLaterUnits+', not found '+arrDbStartUnits);
				arrParents = [];
			}
			
			function handleParents(rows){
			//	var sort_fun = function(row){ return row.unit; };
			//	if (arrParents.length > 0 && !_.isEqual(_.sortBy(rows, sort_fun), _.sortBy(arrParents, sort_fun)))
			//		throw Error("different parents");
				var arrNewStartUnits = [];
				for (var i=0; i<rows.length; i++){
					var objUnitProps = rows[i];
					if (objUnitProps.unit === earlier_unit)
						return handleResult(true);
					if (objUnitProps.main_chain_index !== null && objUnitProps.main_chain_index <= objEarlierUnitProps.latest_included_mc_index)
						continue;
					if (objUnitProps.main_chain_index !== null && objEarlierUnitProps.main_chain_index !== null && objUnitProps.main_chain_index < objEarlierUnitProps.main_chain_index)
						continue;
					if (objUnitProps.main_chain_index !== null && objEarlierUnitProps.main_chain_index === null)
						continue;
					if (objUnitProps.latest_included_mc_index < objEarlierUnitProps.latest_included_mc_index)
						continue;
					if (objUnitProps.witnessed_level < objEarlierUnitProps.witnessed_level && objEarlierUnitProps.main_chain_index > constants.witnessedLevelMustNotRetreatFromAllParentsUpgradeMci)
						continue;
					if (objUnitProps.is_on_main_chain === 0 && objUnitProps.level > objEarlierUnitProps.level)
						arrNewStartUnits.push(objUnitProps.unit);
				}
				arrNewStartUnits = _.uniq(arrNewStartUnits);
				arrNewStartUnits = _.difference(arrNewStartUnits, arrKnownUnits);
				(arrNewStartUnits.length > 0) ? goUp(arrNewStartUnits) : handleResult(false);
			}
			
			if (arrParents.length)
				return setImmediate(handleParents, arrParents);
			
			conn.query(
				"SELECT unit, level, witnessed_level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
				FROM parenthoods JOIN units ON parent_unit=unit \n\
				WHERE child_unit IN(?)",
				[arrStartUnits],
				handleParents
			);
		}
		
		goUp(arrLaterUnits);
	
	});
}
960469
def check_for_maintenance(self):
        '''
        
        '''
        numrevs = self.conn.get_one("SELECT count(revnum) FROM csetLog")[0]
        if numrevs >= SIGNAL_MAINTENACE_CSETS:
            return True
        return False
531715
public void checkSourceStatus(boolean check_gensrc) {
        removedSources = calculateRemovedSources();
        for (Source s : removedSources) {
            if (!s.isGenerated() || check_gensrc) {
                taintPackage(s.pkg().name(), "source "+s.name()+" was removed");
            }
        }

        addedSources = calculateAddedSources();
        for (Source s : addedSources) {
            String msg = null;
            if (isIncremental()) {
                // When building from scratch, there is no point
                // printing "was added" for every file since all files are added.
                // However for an incremental build it makes sense.
                msg = "source "+s.name()+" was added";
            }
            if (!s.isGenerated() || check_gensrc) {
                taintPackage(s.pkg().name(), msg);
            }
        }

        modifiedSources = calculateModifiedSources();
        for (Source s : modifiedSources) {
            if (!s.isGenerated() || check_gensrc) {
                taintPackage(s.pkg().name(), "source "+s.name()+" was modified");
            }
        }
    }
146525
def _is_svc(svc_path):
    '''
    
    '''
    run_file = os.path.join(svc_path, 'run')
    if (os.path.exists(svc_path)
         and os.path.exists(run_file)
         and os.access(run_file, os.X_OK)):
        return True
    return False
642058
def is_ready(instance, pending=False):
    

    last_reload = lookup(instance, 'lastOperatingSystemReload', 'id')
    active_transaction = lookup(instance, 'activeTransaction', 'id')

    reloading = all((
        active_transaction,
        last_reload,
        last_reload == active_transaction,
    ))
    outstanding = False
    if pending:
        outstanding = active_transaction
    if instance.get('provisionDate') and not reloading and not outstanding:
        return True
    return False
575088
def hasBeenRotated(self):
      """"""
      try:
         # If the inodes don't match, it means the file has been replaced.
         # The inode number cannot be recycled as long as we hold the
         # filehandle open, so this test can be trusted.
         return os.stat(self._path).st_ino != self._inode
      except OSError:
         # If the file doesn't exist, let's call it "rotated".
         return True
844113
private function _checkAndBuildStructure()
    {
        if (!($this->_structureChecked)) {
            if (!$this->_checkStructureVersion()) {
                $this->_buildStructure();
                if (!$this->_checkStructureVersion()) {
                    Zend_Cache::throwException("Impossible to build cache structure in " . $this->_options['cache_db_complete_path']);
                }
            }
            $this->_structureChecked = true;
        }
        return true;
    }
161081
def ismonitor(self):
        """"""
        if self.cache_mode is not None:
            return self.cache_mode
        try:
            res = (self.mode() == "monitor")
            self.cache_mode = res
            return res
        except Scapy_Exception:
            return False
45298
public function scPrev()
    {
        $mValue = $this->prev();

        return (false === $mValue and false === $this->valid()) ? self::NOT_SET_FLAG : $mValue;
    }
683837
def hasSubseries(self):
        
        if self.c and self.c[0] and ((self.c[0].level in ('series', 'subseries')) or
                                     (self.c[0].c and self.c[0].c[0])):
            return True
        else:
            return False
900236
def _check_for_unit_changes(name):
    '''
    
    '''
    contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)
    if contextkey not in __context__:
        if _untracked_custom_unit_found(name) or _unit_file_changed(name):
            systemctl_reload()
        # Set context key to avoid repeating this check
        __context__[contextkey] = True
547085
def is_containerized() -> bool:
    '''
    
    '''
    try:
        cginfo = Path('/proc/self/cgroup').read_text()
        if '/docker/' in cginfo or '/lxc/' in cginfo:
            return True
    except IOError:
        return False
55140
def is_running(config, container, *args, **kwargs):
    '''
    
    '''
    try:
        infos = _get_container_infos(config, container)
        return (infos if infos.get('State', {}).get('Running') else None)
    except Exception:
        return None
857809
private boolean checkVmIsOnline() {

		String zoneName = OpenstackIaasHandler.findZoneName( this.novaApi, this.targetProperties );
		Server server = this.novaApi.getServerApiForZone( zoneName ).get(this.machineId);
		return Status.ACTIVE.equals(server.getStatus());
	}
210111
protected function checkCVSPath() {
		$changedFields = $this->getChangedFields(true, 2);
		if (!$this->CVSPath) {
			return;
		}
		if (isset($changedFields['CVSPath']) || isset($changedFields['Name'])) {
			$this->cloneRepo();
		}
	}
122197
@Check(CheckType.FAST)
	public void checkSuperTypes(SarlCapacity capacity) {
		checkSuperTypes(
				capacity,
				SARL_CAPACITY__EXTENDS,
				capacity.getExtends(),
				Capacity.class,
				false);
	}