/*
Parses the subprocess ID out of a user's instance id.
961879
private String getSubProcessInstanceId(String instanceId) {
        int beg = instanceId.indexOf("/");

        if (beg > -1 && beg + 1 < instanceId.length()) {
            return instanceId.substring(beg + 1);
        }

        return "";
    }
827519
function parse(dist) {
  return Object.keys(dist).map((id) => {
    let pid;

    if (id.slice(2, 6) === '0000') {
      pid = '';
    } else if (id.slice(4, 6) === '00') {
      pid = `${id.slice(0, 2)}0000`;
    } else {
      pid = `${id.slice(0, 4)}00`;
    }

    return { id, pid, name: dist[id] };
  });
}
53579
def _usernamesToSidObjects(cls, val, **kwargs):
        '''
        
        '''
        if not val:
            return val
        if isinstance(val, six.string_types):
            val = val.split(',')
        sids = []
        for _user in val:
            try:
                sid = win32security.LookupAccountName('', _user)[0]
                sids.append(sid)
            # This needs to be more specific
            except Exception as e:
                log.exception('Handle this explicitly')
                raise CommandExecutionError((
                    'There was an error obtaining the SID of user "{0}". Error '
                    'returned: {1}'
                    ).format(_user, e))
        return sids
889674
def parse_id(input_id):
    """"""
    parts = input_id.split(':')
    if len(parts) != 2:
        raise exceptions.CLIAbort(
            'Invalid ID %s: ID should be of the form "kind:id"' % input_id)
    return parts[0], int(parts[1])
927359
def _CaptureUserId(self):
    """"""
    user_kind, user_id = user_id_collector()
    if user_kind and user_id:
      self.breakpoint['evaluatedUserId'] = {'kind': user_kind, 'id': user_id}
703032
def container_instance_from_string(id):
    """"""
    try:
        service, instance = id.rsplit('_', 1)
        instance = int(instance)
    except (TypeError, ValueError):
        raise context.ValueError("Invalid container id %r" % id)
    return _proto.ContainerInstance(service_name=service, instance=instance)
751941
def read( handle, id=None ):
    

    from Bio.PDB import PDBParser
    
    if not id:
        id = os.path.basename(handle).split('.')[0] # Get from filename
    
    p = PDBParser()
    s = p.get_structure(id, handle)

    return s
79683
def get_out_subnet_id(cls, tenant_id):
        
        if 'out' not in cls.ip_db_obj:
            LOG.error("Fabric not prepared for tenant %s", tenant_id)
            return None
        db_obj = cls.ip_db_obj.get('out')
        out_subnet_dict = cls.get_out_ip_addr(tenant_id)
        sub = db_obj.get_subnet(out_subnet_dict.get('subnet'))
        return sub.subnet_id
258458
def extract_id(*object_types):
    

    def outer(func):
        def inner(*args, **kwargs):
            def id_of(x):
                return x.id if type(x) in object_types else x

            new_args = [id_of(arg) for arg in args]
            new_kwargs = {k: id_of(v) for k, v in kwargs.items()}
            return func(*new_args, **new_kwargs)

        return inner

    return outer
804370
def validate_instance_id(self, instid):
        '''  '''
        # 1-63 alphanumeric characters, first must be a letter.
        if re.match('[\w-]+$', instid) is not None:
            if len(instid) <= 63 and len(instid) >= 1:
                if instid[0].isalpha():
                    return True
        return "*** Error: Instance ids must be 1-63 alphanumeric characters, \
            first is a letter."
139324
private static long getIdInfo(String option, String username) {
    String output;
    try {
      output = ShellUtils.execCommand("id", option, username).trim();
    } catch (IOException e) {
      LOG.error("Failed to get id from {} with option {}", username, option);
      return -1;
    }
    return Long.parseLong(output);
  }
598775
def current_user_name_or_id
      require 'etc' if !defined?(Etc)
      begin
        user = Etc.getpwuid(Process.uid)
      rescue ArgumentError
        user = nil
      end
      if user
        return user.name
      else
        return "##{Process.uid}"
      end
    end
885727
function parseId(id) {
        var segs = id.split('!');

        if (segs[0]) {
            return {
                mod: segs[0],
                res: segs[1]
            };
        }
    }
1178798
def scrubID(ID):
    

    try:
        if type(ID) == list:
            return int(ID[0])
        elif type(ID) == str:
            return int(ID)
        elif type(ID) == int:
            return ID
        elif type(ID) == unicode:
            return int(ID)

    except ValueError:
        return None
1044133
function parseId(self, id) {
    const { options } = self.schema;

    if (is.string(id)) {
        if (options && options.keyType === 'name') {
            return id;
        } if (options.keyType === 'id') {
            return self.gstore.ds.int(id);
        }
        // auto convert string number to number
        return isFinite(id) ? self.gstore.ds.int(id) : id;
    }

    if (!is.number(id)) {
        throw new Error('id must be a string or a number');
    }

    return id;
}
213134
static int getRegisteredID (Connection connection, Object object) {
		ObjectSpace[] instances = ObjectSpace.instances;
		for (int i = 0, n = instances.length; i < n; i++) {
			ObjectSpace objectSpace = instances[i];
			// Check if the connection is in this ObjectSpace.
			Connection[] connections = objectSpace.connections;
			for (int j = 0; j < connections.length; j++) {
				if (connections[j] != connection) continue;
				// Find an ID with the object.
				int id = objectSpace.objectToID.get(object, Integer.MAX_VALUE);
				if (id != Integer.MAX_VALUE) return id;
			}
		}
		return Integer.MAX_VALUE;
	}
1056126
def _filter_by_user(self, user, pids):
        
        filtered_pids = set()
        for pid in pids:
            try:
                proc = psutil.Process(pid)
                if proc.username() == user:
                    self.log.debug("Collecting pid {} belonging to {}".format(pid, user))
                    filtered_pids.add(pid)
                else:
                    self.log.debug("Discarding pid {} not belonging to {}".format(pid, user))
            except psutil.NoSuchProcess:
                pass

        return filtered_pids