get sysid tuple to use for parameters
421740
def get_sysid(self):
        ''''''
        component = self.target_component
        if component == 0:
            component = 1
        return (self.target_system, component)
816358
def __struct_params_str(obj, fmt, f=repr):
    """"""
    return __struct_params_s(obj, '\n', f=f, fmt=fmt)
254776
def _syspath(dev):
    '''
    
    '''
    dev = _devbase(dev)
    dev = re.sub(r'^([vhs][a-z]+)([0-9]+)', r'\1/\1\2', dev)

    # name = re.sub(r'^([a-z]+)(?<!(bcache|md|dm))([0-9]+)', r'\1/\1\2', name)
    return os.path.join('/sys/block/', dev)
816287
def get_params(self, param_list=None, get_path=False, merged=False, raw=False):
        
        # Convert parameter name to list
        if param_list and isinstance(param_list, str):
            param_list = [param_list]
        if param_list and isinstance(param_list, (list, tuple)):
            result = {k: v for k, v in self._params_found.items() if k in param_list}
            result.update({k: v for k, v in self._params.items() if (k in param_list and k not in result)})
        else:
            result = {k: v for k, v in self._params_found.items()}
            result.update({k: v for k, v in self._params.items() if k not in result})
        if get_path:
            result['path'] = self.unpacked_path
        if merged:
            result.update(self._parser.merge_valued(result))
        if raw:
            result.update({k: v for k, v in self._params_found_raw.items()})
        return result
1132580
def _parametersAsIndex( self, ps ):
        """"""
        k = ""
        for p in sorted(ps.keys()):       # normalise the parameters
            v = ps[p]
            k = k + "{p}=[[{v}]];".format(p = p, v = v)
        return k
311238
def p_param_types(self, p):
        ''''''
        if len(p) == 2:
            p[0] = tuple((t,) for t in p[1])
        elif len(p) == 3:
            p[0] = tuple((t,) for t in p[1]) + ((),)
        elif len(p) == 4:
            p[0] = tuple((t,) + ts for t in p[1] for ts in p[3])
        else:
            non_defaults = [t for t in p[4] if len(t) == len(p[4][0])]
            p[0] = tuple((t,) + ts for t in p[1] for ts in non_defaults) + p[4]
543586
def parse_parameter(self, tup_tree):
        

        self.check_node(tup_tree, 'PARAMETER', ('NAME', 'TYPE'), (),
                        ('QUALIFIER',))

        attrl = attrs(tup_tree)

        qualifiers = self.list_of_matching(tup_tree, ('QUALIFIER',))

        return CIMParameter(attrl['NAME'],
                            type=attrl['TYPE'],
                            is_array=False,
                            qualifiers=qualifiers,
                            embedded_object=False)
1035477
def log_params(params, name="params"):
  """"""
  for i, param in enumerate(params):
    if not param:
      # Empty tuple.
      continue
    if not isinstance(param, (list, tuple)):
      logging.error(
          "%s[%d] : (%s) = [%s]", name, i, param.shape, onp.array(param))
    else:
      for j, p in enumerate(param):
        logging.error(
            "\t%s[%d, %d] = [%s]", name, i, j, onp.array(p))
1043819
def get_param_arg(param, idx, klass, arg, attr='id'):
    """"""
    if isinstance(arg, klass):
        return getattr(arg, attr)
    elif isinstance(arg, (int, str)):
        return arg
    else:
        raise TypeError(
            "%s[%d] must be int, str, or %s, not %s" % (
                param, idx, klass.__name__, type(arg).__name__))
22238
def p_define_params_paramlist(p):
    
    for i in p[2]:
        if not isinstance(i, ID):
            error(p.lineno(3),
                  '"%s" might not appear in a macro parameter list' % str(i))
            p[0] = None
            return

    names = [x.name for x in p[2]]
    for i in range(len(names)):
        if names[i] in names[i + 1:]:
            error(p.lineno(3),
                  'Duplicated name parameter "%s"' % (names[i]))
            p[0] = None
            return

    p[0] = p[2]
303999
def get_sys_info():
    """"""
    blob = dict()
    blob["OS"] = platform.system()
    blob["OS-release"] = platform.release()
    blob["Python"] = platform.python_version()
    return blob
542403
def __struct_params_s(obj, separator=', ', f=repr, fmt='%s = %s'):
    """"""
    s = separator.join([__single_param(obj, n, f, fmt) for n in dir(obj) if __inc_param(obj, n)])
    return s
1342976
def _write_sys_header(self, sys_header):
        
        header_vals = [sys_header[RMIN], sys_header[RMAX], sys_header[ANGLE],
                       sys_header[AWIDTH]]
        self._write_line("##     RMIN    RMAX   ANGLE   AWIDTH")
        self._write_line("# %8.1f%8.1f%8.1f%8.1f" % tuple(map(float, header_vals)))
1084676
def p_sysargs(self, p):
        ''
        p[0] = p[1] + (p[3],)
        p.set_lineno(0, p.lineno(1))
878247
def _fssys(name, value=None, log_lvl=None, log_msg=None):
    '''
    
    '''
    fspath = _fspath()
    if not fspath:
        return False
    else:
        return _sysfs_attr([fspath, name], value, log_lvl, log_msg)
39969
def func_args(func):
    '''
    '''
    try:
        return tuple(inspect.signature(func).parameters)
    except:
        return tuple(inspect.getargspec(func).args)
183486
def pp_tuple(self, tup):
        """"""
        last_line = self.f.getvalue().split("\n")[-1]
        l = len(last_line)+1
        indent = ' ' * l
        self.write('(')
        sep = ''
        for item in tup:
            self.write(sep)
            l += len(sep)
            s = repr(item)
            l += len(s)
            self.write(s)
            sep = ','
            if l > LINE_LENGTH:
                l = 0
                sep += '\n' + indent
            else:
                sep += ' '
                pass
            pass
        if len(tup) == 1:
            self.write(", ")
        self.write(')')