Fill this instance with operating system information.
354181
void putOs() {
    Map<String, Object> os = createMap();
    os.put(OS_NAME_KEY, "Android");
    os.put(OS_VERSION_KEY, Build.VERSION.RELEASE);
    put(OS_KEY, os);
  }
275357
def build_info():
    '''
    
    '''
    ret = {'info': []}
    out = __salt__['cmd.run']('{0} -V'.format(__detect_os()))

    for i in out.splitlines():
        if i.startswith('configure argument'):
            ret['build arguments'] = re.findall(r"(?:[^\s]*'.*')|(?:[^\s]+)", i)[2:]
            continue

        ret['info'].append(i)

    return ret
303999
def get_sys_info():
    """"""
    blob = dict()
    blob["OS"] = platform.system()
    blob["OS-release"] = platform.release()
    blob["Python"] = platform.python_version()
    return blob
301210
private OsType determineOsType(String imageId) {
        InspectImageResponse ir = getClient().inspectImageCmd(imageId).exec();
        if ("linux".equalsIgnoreCase(ir.getOs())) {
            LOG.trace("Detected LINUX operating system for image: {}", imageId);
            return OsType.LINUX;
        } else if ("windows".equalsIgnoreCase(ir.getOs())) {
            LOG.trace("Detected WINDOWS operating system for image: {}", imageId);
            return OsType.WINDOWS;
        } else {
            LOG.trace("Detected OTHER operating system ({}) for image: {}", ir.getOs(), imageId);
            return OsType.OTHER;
        }
    }
514471
function() {
		this.cpu = new CPU( this );
		this.apu = new APU( this );
		this.ppu = new PPU( this );
		this.memory = new Memory( this );

		this.loadCartridge( this.cartridge );
	}
1267804
def system_information
      r = execute(make_xml('SystemInformationRequest', {}))

      if r.success
        res = {}
        r.res.elements.each('//Statistic') do |stat|
          res[stat.attributes['name'].to_s] = stat.text.to_s
        end
        res
      else
        false
      end
    end
383553
def update(self):
        """"""
        # Init new stats
        stats = self.get_init_value()

        if self.input_method == 'local':
            # Update stats using the standard system lib

            # Get the load using the os standard lib
            load = self._getloadavg()
            if load is None:
                stats = self.get_init_value()
            else:
                stats = {'min1': load[0],
                         'min5': load[1],
                         'min15': load[2],
                         'cpucore': self.nb_log_core}

        elif self.input_method == 'snmp':
            # Update stats using SNMP
            stats = self.get_stats_snmp(snmp_oid=snmp_oid)

            if stats['min1'] == '':
                stats = self.get_init_value()
                return stats

            # Python 3 return a dict like:
            # {'min1': "b'0.08'", 'min5': "b'0.12'", 'min15': "b'0.15'"}
            for k, v in iteritems(stats):
                stats[k] = float(v)

            stats['cpucore'] = self.nb_log_core

        # Update the stats
        self.stats = stats

        return self.stats
652308
def get_os(detailed=False):
    
    try:

        os_type = platform.system()

        if os_type == 'Linux':
            os_detail = platform.uname()
            distribution = platform.linux_distribution()
            HOME = os.environ['HOME']
            username = os.getenv('USER')
        elif os_type == 'Windows':
            username = os.getenv('username')
            HOME = 'C:\\Users\\' + username
        elif os_type == 'Java':
            logger.warning('Unsupported OS. No information')
    except OSError as e:
        raise e
    except Exception as e:
        logger.exception(
            '%s: problem determining local os environment %s' %
            (inspect.stack()[0][3], str(e))
            )
    if detailed and os_type == 'Linux':
        return {
                'os_type': os_type,
                'os_detail': os_detail,
                'linux_distribution': distribution,
                'HOME': HOME
            }
    elif detailed and os_type == 'Windows':
        return {
                'os_type': os_type,
                'platform': platform,
                'HOME': HOME
            }
    elif not detailed:
        return {'os_type': os_type}
903762
def create_instance(self, credentials, name, **kwargs):
        """"""
        op_name = create_instance(
            credentials, self.project, self.zone, name,
            machine_type=self.machine_type,
            disk_size_gb=self.disk_size_gb,
            **kwargs)
        
        return op_name
566440
public static OperatingSystem getCurrent() {
    String name = System.getProperty("os.name");
    String version = System.getProperty("os.version");
    String lowerName = name.toLowerCase();
    if (lowerName.contains("linux")) return new OperatingSystem(name, version, Family.LINUX);
    if (lowerName.contains("mac os") || lowerName.contains("darwin")) return new OperatingSystem(name, version, Family.MAC_OS);
    if (lowerName.contains("windows")) return new OperatingSystem(name, version, Family.WINDOWS);
    if (lowerName.contains("sunos")) return new OperatingSystem(name, version, Family.SOLARIS);
    return new OperatingSystem(name, version, Family.OTHER);
  }
462277
def print_app_info(out=sys.stderr):
    """"""
    print("System info:", file=out)
    print(configuration.App, file=out)
    print("Python %(version)s on %(platform)s" %
                    {"version": sys.version, "platform": sys.platform}, file=out)
    stime = strtime(time.time())
    print("Local time:", stime, file=out)
    print("sys.argv", sys.argv, file=out)
71352
def info(cls, name, get_state=True, get_pid=True):
        """"""
        # Run lxc-info quietly
        command = ['lxc-info', '-n', name]
        response = subwrap.run(command)
        lines = map(split_info_line, response.std_out.splitlines())
        return dict(lines)
1203758
def get_system_info():
    '''
    
    '''
    def byte_calc(val):
        val = float(val)
        if val < 2**10:
            return '{0:.3f}B'.format(val)
        elif val < 2**20:
            return '{0:.3f}KB'.format(val / 2**10)
        elif val < 2**30:
            return '{0:.3f}MB'.format(val / 2**20)
        elif val < 2**40:
            return '{0:.3f}GB'.format(val / 2**30)
        else:
            return '{0:.3f}TB'.format(val / 2**40)

    # Lookup dicts for Win32_OperatingSystem
    os_type = {1: 'Work Station',
               2: 'Domain Controller',
               3: 'Server'}

    # lookup dicts for Win32_ComputerSystem
    domain_role = {0: 'Standalone Workstation',
                   1: 'Member Workstation',
                   2: 'Standalone Server',
                   3: 'Member Server',
                   4: 'Backup Domain Controller',
                   5: 'Primary Domain Controller'}
    warning_states = {1: 'Other',
                      2: 'Unknown',
                      3: 'Safe',
                      4: 'Warning',
                      5: 'Critical',
                      6: 'Non-recoverable'}
    pc_system_types = {0: 'Unspecified',
                       1: 'Desktop',
                       2: 'Mobile',
                       3: 'Workstation',
                       4: 'Enterprise Server',
                       5: 'SOHO Server',
                       6: 'Appliance PC',
                       7: 'Performance Server',
                       8: 'Maximum'}

    # Connect to WMI
    with salt.utils.winapi.Com():
        conn = wmi.WMI()

        system = conn.Win32_OperatingSystem()[0]
        ret = {'name': get_computer_name(),
               'description': system.Description,
               'install_date': system.InstallDate,
               'last_boot': system.LastBootUpTime,
               'os_manufacturer': system.Manufacturer,
               'os_name': system.Caption,
               'users': system.NumberOfUsers,
               'organization': system.Organization,
               'os_architecture': system.OSArchitecture,
               'primary': system.Primary,
               'os_type': os_type[system.ProductType],
               'registered_user': system.RegisteredUser,
               'system_directory': system.SystemDirectory,
               'system_drive': system.SystemDrive,
               'os_version': system.Version,
               'windows_directory': system.WindowsDirectory}

        system = conn.Win32_ComputerSystem()[0]
        # Get pc_system_type depending on Windows version
        if platform.release() in ['Vista', '7', '8']:
            # Types for Vista, 7, and 8
            pc_system_type = pc_system_types[system.PCSystemType]
        else:
            # New types were added with 8.1 and newer
            pc_system_types.update({8: 'Slate', 9: 'Maximum'})
            pc_system_type = pc_system_types[system.PCSystemType]
        ret.update({
            'bootup_state': system.BootupState,
            'caption': system.Caption,
            'chassis_bootup_state': warning_states[system.ChassisBootupState],
            'chassis_sku_number': system.ChassisSKUNumber,
            'dns_hostname': system.DNSHostname,
            'domain': system.Domain,
            'domain_role': domain_role[system.DomainRole],
            'hardware_manufacturer': system.Manufacturer,
            'hardware_model': system.Model,
            'network_server_mode_enabled': system.NetworkServerModeEnabled,
            'part_of_domain': system.PartOfDomain,
            'pc_system_type': pc_system_type,
            'power_state': system.PowerState,
            'status': system.Status,
            'system_type': system.SystemType,
            'total_physical_memory': byte_calc(system.TotalPhysicalMemory),
            'total_physical_memory_raw': system.TotalPhysicalMemory,
            'thermal_state': warning_states[system.ThermalState],
            'workgroup': system.Workgroup
        })
        # Get processor information
        processors = conn.Win32_Processor()
        ret['processors'] = 0
        ret['processors_logical'] = 0
        ret['processor_cores'] = 0
        ret['processor_cores_enabled'] = 0
        ret['processor_manufacturer'] = processors[0].Manufacturer
        ret['processor_max_clock_speed'] = six.text_type(processors[0].MaxClockSpeed) + 'MHz'
        for processor in processors:
            ret['processors'] += 1
            ret['processors_logical'] += processor.NumberOfLogicalProcessors
            ret['processor_cores'] += processor.NumberOfCores
            ret['processor_cores_enabled'] += processor.NumberOfEnabledCore

        bios = conn.Win32_BIOS()[0]
        ret.update({'hardware_serial': bios.SerialNumber,
                    'bios_manufacturer': bios.Manufacturer,
                    'bios_version': bios.Version,
                    'bios_details': bios.BIOSVersion,
                    'bios_caption': bios.Caption,
                    'bios_description': bios.Description})
        ret['install_date'] = _convert_date_time_string(ret['install_date'])
        ret['last_boot'] = _convert_date_time_string(ret['last_boot'])
    return ret
407752
def restart():
    
    python = sys.executable
    os.execl(python, python, * sys.argv)
384411
def print_operating_systems(self, operating_systems):
        
        for _os in operating_systems:
            print('{}: {}'.format(_os.name, _os.slug))
1020286
def os_info():
    
    return {
        'uname': dict(platform.uname()._asdict()),
        'path': os.environ.get('PATH', '').split(':'),
        'shell': os.environ.get('SHELL', '/bin/sh'),
    }
1153613
def ossystem(cmd):
  """"""
  p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
                       stderr=subprocess.STDOUT)
  (stdout, stderr) = p.communicate()
  return stdout.decode('ascii')