started project

master
elburg 1 year ago
commit 67f465f7ed

@ -0,0 +1,2 @@
System Information Library for Python
=====================================

@ -0,0 +1,5 @@
__all__ = ['platform']
_LIBMETA={
'version': [0,0,0]
}

@ -0,0 +1,27 @@
_rC = {
0: None # osinfo.py 'osFamily'
}
def _resetCache() -> bool:
try:
for x in _rC:
x = None
return True
except IndexError as e:
from warnings import warn
warn('IndexError was unusually thrown whilst clearing cache ({}). ignoring it...'.format(e.message))
return True
except:
return False
def _reload():
import osinfo
_rC[0]=osinfo.getOSValue('osFamily')
def getAll() -> dict:
return {
'os': {
'family': _rC[0]
}
}

@ -0,0 +1,33 @@
# from .._internal.methods import platform as _discover
def _match(x: int, y: int) -> str:
try:
if x==0: # Kernal Family
return {
0: 'Unknown',
1: 'Unknown POSIX',
2: 'Unix',
3: 'Linux',
4: 'Windows NT',
5: 'BSD',
6: 'Unknown BSD'
}[y]
else:
raise RuntimeError('invalid x id from discovery methods')
except IndexError:
return {
0: 'Unknown'
}[x]
except RuntimeError as e:
raise e
def getOSValue(item: str) -> list:
try:
return {
'osFamily': _match(0,_discover.find('OS_FAMILY'))
}[item]
except IndexError as e:
return None
def dumpOSInfo() -> dict:
return
Loading…
Cancel
Save