Check that spectrum has legal combination of attributes.
974407
def _check(self):
        """"""
        # Run the super method
        super(Spectrum, self)._check()

        err_str = None
        has_data = self._KEYS.DATA in self
        has_wave = self._KEYS.WAVELENGTHS in self
        has_flux = self._KEYS.FLUXES in self
        has_filename = self._KEYS.FILENAME in self

        if not has_data:
            if (not has_wave or not has_flux) and not has_filename:
                err_str = (
                    "If `{}` not given".format(self._KEYS.DATA) +
                    "; `{}` or `{}` needed".format(
                        self._KEYS.WAVELENGTHS, self._KEYS.FLUXES))

        if err_str is not None:
            raise ValueError(err_str)

        return
129107
protected function checkPlatform()
    {
        if (stripos($this->_agent, 'windows') !== false) {
            $this->_platform = self::PLATFORM_WINDOWS;
        } elseif (stripos($this->_agent, 'iPad') !== false) {
            $this->_platform = self::PLATFORM_IPAD;
        } elseif (stripos($this->_agent, 'iPod') !== false) {
            $this->_platform = self::PLATFORM_IPOD;
        } elseif (stripos($this->_agent, 'iPhone') !== false) {
            $this->_platform = self::PLATFORM_IPHONE;
        } elseif (stripos($this->_agent, 'mac') !== false) {
            $this->_platform = self::PLATFORM_APPLE;
        } elseif (stripos($this->_agent, 'android') !== false) {
            $this->_platform = self::PLATFORM_ANDROID;
        } elseif (stripos($this->_agent, 'linux') !== false) {
            $this->_platform = self::PLATFORM_LINUX;
        } elseif (stripos($this->_agent, 'Nokia') !== false) {
            $this->_platform = self::PLATFORM_NOKIA;
        } elseif (stripos($this->_agent, 'BlackBerry') !== false) {
            $this->_platform = self::PLATFORM_BLACKBERRY;
        } elseif (stripos($this->_agent, 'FreeBSD') !== false) {
            $this->_platform = self::PLATFORM_FREEBSD;
        } elseif (stripos($this->_agent, 'OpenBSD') !== false) {
            $this->_platform = self::PLATFORM_OPENBSD;
        } elseif (stripos($this->_agent, 'NetBSD') !== false) {
            $this->_platform = self::PLATFORM_NETBSD;
        } elseif (stripos($this->_agent, 'OpenSolaris') !== false) {
            $this->_platform = self::PLATFORM_OPENSOLARIS;
        } elseif (stripos($this->_agent, 'SunOS') !== false) {
            $this->_platform = self::PLATFORM_SUNOS;
        } elseif (stripos($this->_agent, 'OS\/2') !== false) {
            $this->_platform = self::PLATFORM_OS2;
        } elseif (stripos($this->_agent, 'BeOS') !== false) {
            $this->_platform = self::PLATFORM_BEOS;
        } elseif (stripos($this->_agent, 'win') !== false) {
            $this->_platform = self::PLATFORM_WINDOWS;
        }
    }
484832
def is_subset(self, other):
        """"""
        if isinstance(other, Permissions):
            return (self.value & other.value) == self.value
        else:
            raise TypeError("cannot compare {} with {}".format(self.__class__.__name__, other.__class__.__name__))
425834
def _verify_options(options):
    '''
    
    '''

    # sanity check all vals used for bitwise operations later
    bitwise_args = [('level', options['level']),
                    ('facility', options['facility'])
                    ]
    bitwise_args.extend([('option', x) for x in options['options']])

    for opt_name, opt in bitwise_args:
        if not hasattr(syslog, opt):
            log.error('syslog has no attribute %s', opt)
            return False
        if not isinstance(getattr(syslog, opt), int):
            log.error('%s is not a valid syslog %s', opt, opt_name)
            return False

    # Sanity check tag
    if 'tag' in options:
        if not isinstance(options['tag'], six.string_types):
            log.error('tag must be a string')
            return False
        if len(options['tag']) > 32:
            log.error('tag size is limited to 32 characters')
            return False

    return True
240925
public boolean canBeBundledWith (@Nonnull final WebSiteResourceWithCondition aOther)
  {
    ValueEnforcer.notNull (aOther, "Other");

    // Resource cannot be bundled at all
    if (!m_bIsBundlable || !aOther.isBundlable ())
      return false;

    // Can only bundle resources of the same type
    if (!m_aResource.getResourceType ().equals (aOther.m_aResource.getResourceType ()))
      return false;

    // If the conditional comment is different, items cannot be bundled!
    if (!EqualsHelper.equals (m_sConditionalComment, aOther.m_sConditionalComment))
      return false;

    // If the CSS media list is different, items cannot be bundled!
    if (!EqualsHelper.equals (m_aMediaList, aOther.m_aMediaList))
      return false;

    // Can be bundled!
    return true;
  }
872759
def check(self, radl):
        """"""

        SIMPLE_FEATURES = {
            "outbound": (str, ["YES", "NO"]),
            "outports": (str, check_outports_format),
            "provider_id": (str, None)
        }
        self.check_simple(SIMPLE_FEATURES, radl)
977855
protected function checkPlatform()
    {
        if (!$this->checkPlatformCustom()) { /* Customs rules are always checked first */
            /* Mobile platforms */
            if ($this->containString($this->_agent, array('Windows Phone', 'IEMobile'))) { /* Check Windows Phone (formerly Windows Mobile) before Windows */
                $this->setPlatform(self::PLATFORM_WINDOWS_PHONE);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'Windows CE')) { /* Check Windows CE before Windows */
                $this->setPlatform(self::PLATFORM_WINDOWS_CE);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, array('CPU OS', 'CPU iPhone OS', 'iPhone', 'iPad', 'iPod'))) { /* Check iOS (iPad/iPod/iPhone) before Macintosh */
                $this->setPlatform(self::PLATFORM_IOS);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'Android')) {
                $this->setPlatform(self::PLATFORM_ANDROID);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'BlackBerry', true, false) || $this->containString($this->_agent, array('BB10', 'RIM Tablet OS'))) {
                $this->setPlatform(self::PLATFORM_BLACKBERRY);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'Nokia', true, false)) {
                $this->setPlatform(self::PLATFORM_NOKIA);
                $this->setMobile(true);

            /* Desktop platforms */
            } else if ($this->containString($this->_agent, 'Windows')) {
                $this->setPlatform(self::PLATFORM_WINDOWS);
            } else if ($this->containString($this->_agent, 'Macintosh')) {
                $this->setPlatform(self::PLATFORM_MACINTOSH);
            } else if ($this->containString($this->_agent, 'Linux')) {
                $this->setPlatform(self::PLATFORM_LINUX);
            } else if ($this->containString($this->_agent, 'FreeBSD')) {
                $this->setPlatform(self::PLATFORM_FREEBSD);
            } else if ($this->containString($this->_agent, 'OpenBSD')) {
                $this->setPlatform(self::PLATFORM_OPENBSD);
            } else if ($this->containString($this->_agent, 'NetBSD')) {
                $this->setPlatform(self::PLATFORM_NETBSD);

            /* Discontinued */
            } else if ($this->containString($this->_agent, array('Symbian', 'SymbianOS'))) {
                $this->setPlatform(self::PLATFORM_SYMBIAN);
                $this->setMobile(true);
            } else if ($this->containString($this->_agent, 'OpenSolaris')) {
                $this->setPlatform(self::PLATFORM_OPENSOLARIS);

            /* Generic */
            } else if ($this->containString($this->_agent, 'Win', true, false)) {
                $this->setPlatform(self::PLATFORM_WINDOWS);
            } else if ($this->containString($this->_agent, 'Mac', true, false)) {
                $this->setPlatform(self::PLATFORM_MACINTOSH);
            }
        }

        //Check if it's a 64-bit platform
        if ($this->containString($this->_agent, array('WOW64', 'Win64', 'AMD64', 'x86_64', 'x86-64', 'ia64', 'IRIX64',
                'ppc64', 'sparc64', 'x64;', 'x64_64'))) {
            $this->set64bit(true);
        }

        $this->checkPlatformVersion();
    }
1368358
private <T> void check(T t, BiConsumer<T, AddOnModel> specific) {
        if (!shouldCheck()) {
            return;
        }
        secureAccess.doElevated(this::getAddOnModelForClassLoader)
            .ifPresent(addOnModel ->
                    secureAccess.doElevated(() -> specific.accept(t, addOnModel)));
    }
5101
def can_view(self, user):
        """"""
        return user.is_admin or self == user \
            or set(self.classes).intersection(user.admin_for)
1131512
protected function checkPlatform() 
    {
        if( stripos($this->_agent, 'iPad') !== false ) 
        {
		    $this->_platform = self::PLATFORM_APPLE; // iOS folgt spaeter
	    }
	    elseif( stripos($this->_agent, 'iPod') !== false ) 
	    {
		    $this->_platform = self::PLATFORM_APPLE; // iOS folgt spaeter
	    }
	    elseif( stripos($this->_agent, 'iPhone') !== false ) 
	    {
		    $this->_platform = self::PLATFORM_APPLE; // iOS folgt spaeter
	    }
	    elseif( stripos($this->_agent, 'android') !== false ) {
		    $this->_platform = self::PLATFORM_ANDROID;
	    }
	    elseif( stripos($this->_agent, 'mac') !== false ) {
	        $this->_platform = self::PLATFORM_APPLE;
	    }
	    elseif( stripos($this->_agent, 'linux') !== false ) {
		    $this->_platform = self::PLATFORM_LINUX;
	    }
	    elseif( stripos($this->_agent, 'windows phone') !== false ) {
	        $this->_platform = self::PLATFORM_WINDOWS_PHONE;
	    }
	    elseif( stripos($this->_agent, 'Nokia') !== false ) {
		    $this->_platform = self::PLATFORM_NOKIA;
	    }
	    elseif( stripos($this->_agent, 'BlackBerry') !== false ) {
		    $this->_platform = self::PLATFORM_BLACKBERRY;
	    }
	    elseif( stripos($this->_agent, 'windows ce') !== false ) {
	        $this->_platform = self::PLATFORM_WINDOWS_CE;
	    }
	    elseif( stripos($this->_agent, 'windows') !== false ) {
	        $this->_platform = self::PLATFORM_WINDOWS;
	    }
	    elseif( stripos($this->_agent,'FreeBSD') !== false ) {
		    $this->_platform = self::PLATFORM_FREEBSD;
	    }
	    elseif( stripos($this->_agent,'OpenBSD') !== false ) {
		    $this->_platform = self::PLATFORM_OPENBSD;
	    }
	    elseif( stripos($this->_agent,'NetBSD') !== false ) {
		    $this->_platform = self::PLATFORM_NETBSD;
	    }
	    elseif( stripos($this->_agent, 'OpenSolaris') !== false ) {
		    $this->_platform = self::PLATFORM_OPENSOLARIS;
	    }
	    elseif( stripos($this->_agent, 'SunOS') !== false ) {
		    $this->_platform = self::PLATFORM_SUNOS;
	    }
	    elseif( stripos($this->_agent, 'OS/2') !== false ) {
		    $this->_platform = self::PLATFORM_OS2;
	    }
	    elseif( stripos($this->_agent, 'BeOS') !== false ) {
		    $this->_platform = self::PLATFORM_BEOS;
	    }
	    elseif( stripos($this->_agent, 'win') !== false ) {
		    $this->_platform = self::PLATFORM_WINDOWS;
	    }
	    // add BugBuster
	    elseif( stripos($this->_agent, 'PHP') !== false ) {
		    $this->_platform = self::PLATFORM_PHP;
	    }
	    // add BugBuster
	    elseif( stripos($this->_agent, 'PLAYSTATION') !== false ) {
	        $this->_platform = self::PLATFORM_PLAYSTATION;
	    }

    }
897979
public function hasMyhillProperty() {
		$spectrum = $this->spectrum();
		foreach ($spectrum as $s) {
			if (count($s) != 2) {
				return false;
			}
		}
		return true;
	}
488968
public static boolean satisfiesSome( IConjunct condition, PropertySet properties)
    {
    boolean satisfies;
    Iterator<IDisjunct> disjuncts;
    for( disjuncts = condition.getDisjuncts(),
           satisfies = !disjuncts.hasNext();
         
         !satisfies
           && disjuncts.hasNext();

         satisfies = disjuncts.next().satisfied( properties));

    return satisfies;
    }
900629
public function spectrum_scan($ap_mac)
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $payload  = ['cmd' => 'spectrum-scan', 'mac' => strtolower($ap_mac)];
        $response = $this->exec_curl('/api/s/' . $this->site . '/cmd/devmgr', $payload);

        return $this->process_response_boolean($response);
    }
357654
def check(self, request, consumer, token, signature):
        """"""
        built = self.sign(request, consumer, token)
        return built == signature
1363918
def _multitaper_spectrum(self, clm, k, convention='power', unit='per_l',
                             clat=None, clon=None, coord_degrees=True,
                             lmax=None, taper_wt=None):
        
        if lmax is None:
            lmax = clm.lmax

        if (clat is not None and clon is not None and clat == self.clat and
                clon == self.clon and coord_degrees is self.coord_degrees and
                k <= self.nwinrot):
            # use the already stored coeffs
            pass
        elif (clat is None and clon is None) and \
                (self.clat is not None and self.clon is not None and
                 k <= self.nwinrot):
            # use the already stored coeffs
            pass
        else:
            if clat is None:
                clat = self.clat
            if clon is None:
                clon = self.clon
            if (clat is None and clon is not None) or \
                    (clat is not None and clon is None):
                raise ValueError('clat and clon must both be input. ' +
                                 'clat = {:s}, clon = {:s}'
                                 .format(repr(clat), repr(clon)))
            if clat is None and clon is None:
                self.rotate(clat=90., clon=0., coord_degrees=True, nwinrot=k)
            else:
                self.rotate(clat=clat, clon=clon, coord_degrees=coord_degrees,
                            nwinrot=k)

        sh = clm.to_array(normalization='4pi', csphase=1, lmax=lmax)

        if taper_wt is None:
            mtse, sd = _shtools.SHMultiTaperMaskSE(sh, self.coeffs,
                                                   lmax=lmax, k=k)
        else:
            mtse, sd = _shtools.SHMultiTaperMaskSE(sh, self.coeffs, lmax=lmax,
                                                   k=k, taper_wt=taper_wt)

        if (unit == 'per_l'):
            pass
        elif (unit == 'per_lm'):
            degree_l = _np.arange(len(mtse))
            mtse /= (2.0 * degree_l + 1.0)
            sd /= (2.0 * degree_l + 1.0)
        else:
            raise ValueError(
                "unit must be 'per_l' or 'per_lm'." +
                "Input value was {:s}".format(repr(unit)))

        if (convention == 'power'):
            return mtse, sd
        elif (convention == 'energy'):
            return mtse * 4.0 * _np.pi, sd * 4.0 * _np.pi
        else:
            raise ValueError(
                "convention must be 'power' or 'energy'." +
                "Input value was {:s}".format(repr(convention)))
403351
def match(tgt, opts=None):
    '''
    
    '''
    if not opts:
        return bool(re.match(tgt, __opts__['id']))
    else:
        return bool(re.match(tgt, opts['id']))
1288860
public function check_capabilities() {
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
			return false;
		}

		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
			return false;
		}

		return true;
	}