Determine if the current platform has the selector available
495752
def has_selector(selector):
    ""
    try:
        if selector == 'poll':
            # the select module offers the poll selector even if the platform
            # doesn't support it. Attempt to poll for nothing to make sure
            # poll is available
            p = select.poll()
            p.poll(0)
        else:
            # the other selectors will fail when instantiated
            getattr(select, selector)().close()
        return True
    except (OSError, AttributeError):
        return False
131590
protected function determine() {
		$this->checkPlatform();
		$this->checkBrowsers();
		$this->checkForAol();
		$this->reduceVersion(); //modified for compatibility
		$this->checkPlatformVersion();	//add BugBuster
	}
1209609
function detectPlatform(platform) {
    var name = platform.toLowerCase();
    var prefix = "", suffix = "";

    // Detect NuGet/Squirrel.Windows files
    if (name == 'releases' || hasSuffix(name, '.nupkg')) return platforms.WINDOWS_32;

    // Detect prefix: osx, widnows or linux
    if (_.contains(name, 'win')
        || hasSuffix(name, '.exe')) prefix = platforms.WINDOWS;

    if (_.contains(name, 'linux')
        || _.contains(name, 'ubuntu')
        || hasSuffix(name, '.deb')
        || hasSuffix(name, '.rpm')
        || hasSuffix(name, '.tgz')
        || hasSuffix(name, '.tar.gz')) {

        if (_.contains(name, 'linux_deb') || hasSuffix(name, '.deb')) {
            prefix = platforms.LINUX_DEB;
        }
        else if (_.contains(name, 'linux_rpm') || hasSuffix(name, '.rpm')) {
            prefix = platforms.LINUX_RPM;
        }
        else if (_.contains(name, 'linux') || hasSuffix(name, '.tgz') || hasSuffix(name, '.tar.gz')) {
            prefix = platforms.LINUX;
        }
    }

    if (_.contains(name, 'mac')
        || _.contains(name, 'osx')
        || name.indexOf('darwin') >= 0
        || hasSuffix(name, '.dmg')) prefix = platforms.OSX;

    // Detect suffix: 32 or 64
    if (_.contains(name, '32')
        || _.contains(name, 'ia32')
        || _.contains(name, 'i386')) suffix = '32';
    if (_.contains(name, '64') || _.contains(name, 'x64') || _.contains(name, 'amd64')) suffix = '64';

    suffix = suffix || (prefix == platforms.OSX? '64' : '32');
    return _.compact([prefix, suffix]).join('_');
}
92709
def has_app(name, check_platform=True):
        """"""
        if check_platform:
            Environment._platform_is_windows()
        return which(str(name)) is not None
542245
function satisfiesPlatform(platform, list) {
    if (_.contains(list, platform)) return true;

    // By default, user 32bits version
    if (_.contains(list+'_32', platform)) return true;

    return false;
}
773005
function getPlatformExtension(file, platforms = SUPPORTED_PLATFORM_EXTS) {
  const last = file.lastIndexOf('.');
  const secondToLast = file.lastIndexOf('.', last - 1);
  if (secondToLast === -1) {
    return null;
  }
  const platform = file.substring(secondToLast + 1, last);
  return platforms.has(platform) ? platform : null;
}
414340
def DefaultSelector(sock):
    ""
    global _DEFAULT_SELECTOR
    if _DEFAULT_SELECTOR is None:
        if has_selector('poll'):
            _DEFAULT_SELECTOR = PollSelector
        elif hasattr(select, 'select'):
            _DEFAULT_SELECTOR = SelectSelector
        else:
            raise RedisError('Platform does not support any selectors')
    return _DEFAULT_SELECTOR(sock)
695988
function() {
			for (var i=0, t, m; t=this.osInfo[i]; i++) {
				if (enyo.platform[t.os] < t.version) {
					return false;
				}
			}
			return true;
		}
519068
public static boolean isPlatformSRE(ISREInstall sre) {
		if (sre != null) {
			LOCK.lock();
			try {
				return platformSREInstalls.contains(sre.getId());
			} finally {
				LOCK.unlock();
			}
		}
		return false;
	}
1232872
protected function checkPlatformVersion() 
    {
        // based on browscap.ini
        if ($this->_platform == self::PLATFORM_WINDOWS) 
        {
	        /*if( stripos($this->_agent, 'windows NT 7.1') !== false ) {
			    $this->_platform = self::PLATFORM_WINDOWS_7;
		    }
	        else*/
            if( stripos($this->_agent, 'windows NT 10.0') !== false ) 
            {
                $this->_platformVersion = self::PLATFORM_WINDOWS_10;
            }
            elseif( stripos($this->_agent, 'windows NT 6.3') !== false ) 
            {
                $this->_platformVersion = self::PLATFORM_WINDOWS_81;
                if( stripos($this->_agent, 'arm') !== false )
                {
                    $this->_platformVersion = self::PLATFORM_WINDOWS_RT;
                }
            }
            elseif( stripos($this->_agent, 'windows NT 6.2') !== false ) 
            {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_8;
			    if( stripos($this->_agent, 'arm') !== false ) 
			    {
			        $this->_platformVersion = self::PLATFORM_WINDOWS_RT;
			    }
		    }
		    elseif( stripos($this->_agent, 'windows NT 6.1') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_7;
		    }
		    elseif( stripos($this->_agent, 'windows NT 6.0') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_VISTA;
		    }
		    elseif( stripos($this->_agent, 'windows NT 5.2') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_2003;
		    }
		    elseif( stripos($this->_agent, 'windows NT 5.1') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_XP;
		    }
		    elseif( stripos($this->_agent, 'windows XP') !== false ) {
		        $this->_platformVersion = self::PLATFORM_WINDOWS_XP;
		    }
		    elseif( stripos($this->_agent, 'windows NT 5.0') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_2000;
		    }
		    elseif( stripos($this->_agent, 'windows NT 4.0') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_NT;
		    }
		    elseif( stripos($this->_agent, 'windows Me') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_ME;
		    }
		    elseif( stripos($this->_agent, 'windows 98') !== false ) {
			    $this->_platformVersion = self::PLATFORM_WINDOWS_98;
		    }
		    elseif( stripos($this->_agent, 'windows 95') !== false ) {
		        $this->_platformVersion = self::PLATFORM_WINDOWS_95;
		    }
        }

        if ($this->_platform == self::PLATFORM_WINDOWS_PHONE)
        {
            if ( stripos($this->_agent, 'Windows Phone OS') !== false )
            {
                $aresult = explode(' ',stristr($this->_agent,'Windows Phone OS'));
                $this->_platformVersion = self::PLATFORM_WINDOWS_PHONE .' '. str_replace(array('(',')',';'),'',$aresult[3]);
            }
            elseif ( stripos($this->_agent, 'Windows Phone') !== false )
            {
                $aresult = explode(' ',stristr($this->_agent,'Windows Phone'));
                $this->_platformVersion = self::PLATFORM_WINDOWS_PHONE .' '. str_replace(array('(',')',';'),'',$aresult[2]);
            }
        }
        
        if ($this->_platform == self::PLATFORM_APPLE)
        {
            if ( stripos($this->_agent, 'Mac OS X') !== false ) 
            {
                $this->_platformVersion = self::PLATFORM_MACOSX;
            }
            if ( stripos($this->_agent, 'iPad') !== false 
              || stripos($this->_agent, 'iPod') !== false
              || stripos($this->_agent, 'iPhone') !== false) 
            {
                $this->_platformVersion = self::PLATFORM_IOSX;
            }
        }
	    elseif( stripos($this->_agent, 'Warp 4') !== false ) {
		    $this->_platformVersion = self::PLATFORM_WARP4;
	    }
    }
658693
def DefaultSelector():
    
    global _DEFAULT_SELECTOR
    if _DEFAULT_SELECTOR is None:
        if platform.python_implementation() == 'Jython':  # Platform-specific: Jython
            _DEFAULT_SELECTOR = JythonSelectSelector
        elif _can_allocate('kqueue'):
            _DEFAULT_SELECTOR = KqueueSelector
        elif _can_allocate('devpoll'):
            _DEFAULT_SELECTOR = DevpollSelector
        elif _can_allocate('epoll'):
            _DEFAULT_SELECTOR = EpollSelector
        elif _can_allocate('poll'):
            _DEFAULT_SELECTOR = PollSelector
        elif hasattr(select, 'select'):
            _DEFAULT_SELECTOR = SelectSelector
        else:  # Platform-specific: AppEngine
            raise RuntimeError('Platform does not have a selector.')
    return _DEFAULT_SELECTOR()
1200463
def available(self, context):
	
		
		
		if self.__available is None:
			avail = False
			name = context.resolve(self.__name)
			for box in self.__box_list():
				if box["name"] == name and box["version"] == "0":
					avail = True
					break
			self.__available = avail
		return self.__available
890298
def get_platform_node_selector(self, platform):
        
        nodeselector = {}
        if platform:
            nodeselector_str = self._get_value("node_selector." + platform, self.conf_section,
                                               "node_selector." + platform)
            nodeselector = self.generate_nodeselector_dict(nodeselector_str)

        return nodeselector
955860
def is_applicable_selector(selector, filter):
    
    for test in selector.allTests():
        if not test.isCompatible(filter.tests):
            return False
    
    return True
751771
def get_platform():
	""""""
	# Detect
	platform_str = platform.system()
	print 'Platform detected: {}'.format(platform_str)
	# Instantiate
	if platform_str == 'Windows':
		return WindowsPlatform()
	elif platform_str == 'Linux':
		return LinuxPlatform()
	else:
		raise NotImplementedError('This platform is not yet supported')
1330534
def is_element_available(self, locator):
        
        if self.driver.is_element_present(locator):
            if self.driver.is_visible(locator):
                return True
            else:
                return False
        else:
            return False
1367765
function is(node, selector) {
    return (node.matches
            || node.webkitMatchesSelector
            || node.mozMatchesSelector
            || node.msMatchesSelector
            || node.oMatchesSelector).call(node, selector);
}