Identify platform.
186560
def getPlatformInfo():
  """"""
  if "linux" in sys.platform:
    platform = "linux"
  elif "darwin" in sys.platform:
    platform = "darwin"
  # win32
  elif sys.platform.startswith("win"):
    platform = "windows"
  else:
    raise Exception("Platform '%s' is unsupported!" % sys.platform)
  return platform
491760
def get_hw_family(self, version_text):
        """"""
        family = None
        if version_text is None:
            return family

        match = re.search(self.platform_re, version_text, re.MULTILINE)
        if match:
            self.platform_string = match.group()
            self.log("Platform string: {}".format(match.group()))
            self.raw_family = match.group(1)
            # sort keys on len reversed (longest first)
            for key in sorted(self.families, key=len, reverse=True):
                if self.raw_family.startswith(key):
                    family = self.families[key]
                    break
            else:
                self.log("Platform {} not supported".format(family))
        else:
            self.log("Platform string not present. Refer to CSCux08958")
        return family
1105524
public function getPlatformInfo()
    {
        if (isset($this->queriesResultCache[ 'platformInfo' ])) {
            return $this->queriesResultCache[ 'platformInfo' ];
        }

        return $this->queriesResultCache[ 'platformInfo' ] = $this->platformGetPlatformInfoHandler();
    }
516334
function getPlatforms(tdef) {
	const platforms = [];

	if (tdef) {
		tdef.deployUnits.array.forEach((du) => {
			const platform = du.findFiltersByID('platform');
			if (platform && platforms.indexOf(platform.value) === -1) {
				platforms.push(platform.value);
			}
		});
	}

	return platforms;
}
1113954
def installedApp(self):
        """"""
        try:    return self._installedApp
        except: # raises if not yet defined
            self._installedApp = runConfigs.get() # application/install/platform management
            return self._installedApp
814625
def controller_info(self):
        """"""

        return [self._device.iotile_id, _pack_version(*self.os_info), _pack_version(*self.app_info)]
350232
def get_platform():
    """"""
    plat = platform_detect.platform_detect()
    if plat == platform_detect.RASPBERRY_PI:
        # Check for version 1 or 2 of the pi.
        version = platform_detect.pi_version()
        if version == 1:
            from . import Raspberry_Pi
            return Raspberry_Pi
        elif version == 2:
            from . import Raspberry_Pi_2
            return Raspberry_Pi_2
        elif version == 3:
            """Use Pi 2 driver even though running on Pi 3"""
            from . import Raspberry_Pi_2
            return Raspberry_Pi_2
        else:
            raise RuntimeError('No driver for detected Raspberry Pi version available!')
    elif plat == platform_detect.BEAGLEBONE_BLACK:
        from . import Beaglebone_Black
        return Beaglebone_Black
    else:
        raise RuntimeError('Unknown platform.')
298042
def _get_capirca_platform():  # pylint: disable=too-many-return-statements
    '''
    
    '''
    vendor = __grains__['vendor'].lower()
    os_ = __grains__['os'].lower()
    model = __grains__['model'].lower()
    if vendor == 'juniper' and 'srx' in model:
        return 'junipersrx'
    elif vendor == 'cisco' and os_ == 'ios':
        return 'cisco'
    elif vendor == 'cisco' and os_ == 'iosxr':
        return 'ciscoxr'
    elif vendor == 'cisco' and os_ == 'asa':
        return 'ciscoasa'
    elif os_ == 'linux':
        return 'iptables'
    elif vendor == 'palo alto networks':
        return 'paloaltofw'
    # anything else will point to the vendor
    # i.e.: some of the Capirca platforms are named by the device vendor
    # e.g.: eOS => arista, junos => juniper, etc.
    return vendor
881229
public static Platform detect() throws UnsupportedPlatformException {
        String osArch = getProperty("os.arch");
        String osName = getProperty("os.name");

        for (Arch arch : Arch.values()) {
            if (arch.pattern.matcher(osArch).matches()) {
                for (OS os : OS.values()) {
                    if (os.pattern.matcher(osName).matches()) {
                        return new Platform(arch, os);
                    }
                }
            }
        }

        String msg = String.format("Unsupported platform %s %s", osArch, osName);
        throw new UnsupportedPlatformException(msg);
    }
332331
def get_current_platform():
    
    board_info_dir = '/sys/class/board-info/'

    if not os.path.exists(board_info_dir) or os.environ.get("FAKE_SYS"):
        return 'fake'

    for board in os.listdir(board_info_dir):
        uevent_filename = os.path.join(board_info_dir, board, 'uevent')

        if os.path.exists(uevent_filename):
            with open(uevent_filename, 'r') as fh:
                for line in fh.readlines():
                    (key, value) = line.strip().split('=')

                    if key == 'BOARD_INFO_MODEL':

                        if value == 'LEGO MINDSTORMS EV3':
                            return 'ev3'

                        elif value in ('FatcatLab EVB', 'QuestCape'):
                            return 'evb'

                        elif value == 'PiStorms':
                            return 'pistorms'

                        # This is the same for both BrickPi and BrickPi+.
                        # There is not a way to tell the difference.
                        elif value == 'Dexter Industries BrickPi':
                            return 'brickpi'

                        elif value == 'Dexter Industries BrickPi3':
                            return 'brickpi3'

                        elif value == 'FAKE-SYS':
                            return 'fake'

    return None
643745
public boolean isAvailableInPlatform(String p) {
        if (this.platform.equals(PLATFORM_ALL))
            return true;
        else
            return (this.platform.equals(p));
    }
179051
def _detect_database_platform(self):
        
        version = self._get_database_platform_version()

        if version is not None:
            self._platform = self._create_database_platform_for_version(version)
        else:
            self._platform = self.get_dbal_platform()
841233
def Platform(name = platform_default()):
    
    module = platform_module(name)
    spec = PlatformSpec(name, module.generate)
    return spec
1156532
protected function checkPlatformCustom()
    {
        foreach ($this->_customPlatformDetection as $platformName => $customPlatform) {
            $platformNameToLookFor = $customPlatform['platformNameToLookFor'];
            $isMobile = $customPlatform['isMobile'];
            if ($this->containString($this->_agent, $platformNameToLookFor)) {
                $this->setPlatform($platformName);
                if ($isMobile) {
                    $this->setMobile(true);
                }
                return true;
            }
        }

        return false;
    }
1095501
def identify(self, req, resp, resource, uri_kwargs):
        """"""
        try:
            return req.get_header('X-Api-Key', True)
        except (KeyError, HTTPMissingHeader):
            pass
267128
def opens_platforms(self, tag=None, fromdate=None, todate=None):
        
        return self.call("GET", "/stats/outbound/opens/platforms", tag=tag, fromdate=fromdate, todate=todate)
684817
def platform_detect():
    """"""
    # Handle Raspberry Pi
    pi = pi_version()
    if pi is not None:
        return RASPBERRY_PI

    # Handle Beaglebone Black
    # TODO: Check the Beaglebone Black /proc/cpuinfo value instead of reading
    # the platform.
    plat = platform.platform()
    if plat.lower().find('armv7l-with-debian') > -1:
        return BEAGLEBONE_BLACK
    elif plat.lower().find('armv7l-with-ubuntu') > -1:
        return BEAGLEBONE_BLACK
    elif plat.lower().find('armv7l-with-glibc2.4') > -1:
        return BEAGLEBONE_BLACK
    elif plat.lower().find('armv7l-with-arch') > -1:
        return BEAGLEBONE_BLACK

    # Couldn't figure out the platform, just return unknown.
    return UNKNOWN