text
stringlengths
0
828
return self._resolve_call('RAD_GEO_LOCATION', column, value, **kwargs)"
1991,"def regulation(self, column=None, value=None, **kwargs):
""""""
Provides relevant information about applicable regulations.
>>> RADInfo().regulation('title_id', 40)
""""""
return self._resolve_call('RAD_REGULATION', column, value, **kwargs)"
1992,"def regulatory_program(self, column=None, value=None, **kwargs):
""""""
Identifies the regulatory authority governing a facility, and, by
virtue of that identification, also identifies the regulatory program
of interest and the type of facility.
>>> RADInfo().regulatory_program('sec_cit_ref_flag', 'N')
""""""
return self._resolve_call('RAD_REGULATORY_PROG', column,
value, **kwargs)"
1993,"def collect_basic_info():
""""""
collect basic info about the system, os, python version...
""""""
s = sys.version_info
_collect(json.dumps({'sys.version_info':tuple(s)}))
_collect(sys.version)
return sys.version"
1994,"def call(function):
""""""
decorator that collect function call count.
""""""
message = 'call:%s.%s' % (function.__module__,function.__name__)
@functools.wraps(function)
def wrapper(*args, **kwargs):
_collect(message)
return function(*args, **kwargs)
return wrapper"
1995,"def _parse_ip_addr_show(raw_result):
""""""
Parse the 'ip addr list dev' command raw output.
:param str raw_result: os raw result string.
:rtype: dict
:return: The parsed result of the show interface command in a \
dictionary of the form:
::
{
'os_index' : '0',
'dev' : 'eth0',
'falgs_str': 'BROADCAST,MULTICAST,UP,LOWER_UP',
'mtu': 1500,
'state': 'down',
'link_type' 'ether',
'mac_address': '00:50:56:01:2e:f6',
'inet': '20.1.1.2',
'inet_mask': '24',
'inet6': 'fe80::42:acff:fe11:2',
'inte6_mask': '64'
}
""""""
# does link exist?
show_re = (
r'""(?P<dev>\S+)""\s+does not exist'
)
re_result = search(show_re, raw_result)
result = None
if not (re_result):
# match top two lines for serveral 'always there' variables
show_re = (
r'\s*(?P<os_index>\d+):\s+(?P<dev>\S+):\s+<(?P<falgs_str>.*)?>.*?'
r'mtu\s+(?P<mtu>\d+).+?state\s+(?P<state>\w+).*'
r'\s*link/(?P<link_type>\w+)\s+(?P<mac_address>\S+)'
)
re_result = search(show_re, raw_result, DOTALL)
result = re_result.groupdict()
# seek inet if its there
show_re = (
r'((inet )\s*(?P<inet>[^/]+)/(?P<inet_mask>\d{1,2}))'
)
re_result = search(show_re, raw_result)
if (re_result):
result.update(re_result.groupdict())
# seek inet6 if its there
show_re = (
r'((?<=inet6 )(?P<inet6>[^/]+)/(?P<inet6_mask>\d{1,2}))'
)
re_result = search(show_re, raw_result)
if (re_result):
result.update(re_result.groupdict())
# cleanup dictionary before returning
for key, value in result.items():
if value is not None: