instance_ports_list : instance_ports_list COMMA instance_port_list
176312
def p_instance_ports_list(self, p):
        ''
        p[0] = p[1] + (p[3],)
        p.set_lineno(0, p.lineno(1))
154750
def loop_template_list(loop_positions, instance, instance_type,
                       default_template, registry):
    
    templates = []
    local_loop_position = loop_positions[1]
    global_loop_position = loop_positions[0]
    instance_string = slugify(str(instance))

    for key in ['%s-%s' % (instance_type, instance_string),
                instance_string,
                instance_type,
                'default']:
        try:
            templates.append(registry[key][global_loop_position])
        except KeyError:
            pass

    templates.append(
        append_position(default_template, global_loop_position, '-'))
    templates.append(
        append_position(default_template, local_loop_position, '_'))
    templates.append(default_template)

    return templates
1060983
def instances(self, test_type=".*"):
        
        import re
        data = {}
        for k, v in self.instances_dict.iteritems():
            if re.match(test_type, v.get('test_type'), re.IGNORECASE):
                if 'filter_type' in v:
                    hostfilter = {
                        'filtertype': v['filter_type'],
                        'content': v['filter_value']
                    }
                else:
                    hostfilter = {}
                data[k] = {
                    'name': v.get('name'),
                    'start': v.get('start'),
                    'end': v.get('end'),
                    'url': v.get('url'),
                    'hostfilter': hostfilter,
                    'test_type': v.get('test_type')
                }
        return data
715547
def get_host_port_names(self, host_name):
        
        port_names = list()
        host = self.get_hosts_by_name(host_name)
        fc_ports = host.fc_ports
        iscsi_ports = host.iscsi_ports
        port_names.extend(fc_ports.split(',') if fc_ports != '' else [])
        port_names.extend(iscsi_ports.split(',') if iscsi_ports != '' else [])
        return port_names
940524
def do_list_port(self, line):
        

        def f(p, args):
            o = p.get()
            for p in o.resources.port:
                print('%s %s %s' % (p.resource_id, p.name, p.number))

        self._request(line, f)
1284522
def p_instance_port_arg(self, p):
        ''
        p[0] = PortArg(p[2], p[4], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
628029
def iterate_multiple_addresses(self, ports: (str, list, tuple)):
        
        if isinstance(ports, (str, int)):
            # TODO: verify this works.
            ports = tuple(ports,)

        result = []
        for port in ports:
            result.append(self.to_address(port))

        return result
694407
def _return_comma_list(self, l):
        
        if isinstance(l, (text_type, int)):
            return l

        if not isinstance(l, list):
            raise TypeError(l, ' should be a list of integers, \
not {0}'.format(type(l)))

        str_ids = ','.join(str(i) for i in l)

        return str_ids
328708
def csvtolist(inputstr):
    
    reader = csv.reader([inputstr], skipinitialspace=True)
    output = []
    for r in reader:
        output += r
    return output
1273782
def p_portlist_empty(self, p):
        ''
        p[0] = Portlist(ports=(), lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
1360520
def get_port_range(port_def):
    '''
    
    '''
    if isinstance(port_def, six.integer_types):
        # Single integer, start/end of range is the same
        return port_def, port_def
    try:
        comps = [int(x) for x in split(port_def, '-')]
        if len(comps) == 1:
            range_start = range_end = comps[0]
        else:
            range_start, range_end = comps
        if range_start > range_end:
            raise ValueError('start > end')
    except (TypeError, ValueError) as exc:
        if exc.__str__() == 'start > end':
            msg = (
                'Start of port range ({0}) cannot be greater than end of '
                'port range ({1})'.format(range_start, range_end)
            )
        else:
            msg = '\'{0}\' is non-numeric or an invalid port range'.format(
                port_def
            )
        raise ValueError(msg)
    else:
        return range_start, range_end
421376
def comma_list(cls, string):
        ''''''
        items = string.split(',')
        items = list([item.strip() for item in items])
        return items
353466
def _build_instance_group_list_args(self, instance_groups):
        
        if type(instance_groups) != types.ListType:
            instance_groups = [instance_groups]

        params = {}
        for i, instance_group in enumerate(instance_groups):
            ig_dict = self._build_instance_group_args(instance_group)
            for key, value in ig_dict.iteritems():
                params['InstanceGroups.member.%d.%s' % (i+1, key)] = value
        return params
843272
def get_ports(proto='tcp', direction='in'):
    '''
    
    '''

    proto = proto.upper()
    direction = direction.upper()
    results = {}
    _validate_direction_and_proto(direction, proto)
    directions = build_directions(direction)
    for direction in directions:
        option = '{0}_{1}'.format(proto, direction)
        results[direction] = _csf_to_list(option)

    return results
86841
def p_instance_port_arg_none(self, p):
        ''
        p[0] = PortArg(p[2], None, lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
408970
def _check_listening_on_ports_list(ports):
    
    ports_open = [port_has_listener('0.0.0.0', p) for p in ports]
    return zip(ports, ports_open), ports_open
77057
def get_instance_route53_names(self, instance):
        '''  '''

        instance_attributes = [ 'public_dns_name', 'private_dns_name',
                                'ip_address', 'private_ip_address' ]

        name_list = set()

        for attrib in instance_attributes:
            try:
                value = getattr(instance, attrib)
            except AttributeError:
                continue

            if value in self.route53_records:
                name_list.update(self.route53_records[value])

        return list(name_list)