The :attr:`port` attribute can be set either by name or by its numeric
        value. This method attempt to fix the semantics of name/number as its
        extremely convenient.
778221
def _fix_port_assignment(self):
        

        port_name = ''
        port_number = None

        if self._port:
            if isinstance(self._port, int):
                port_number = self._port
                port_name = get_port_name(port_number)
            elif isinstance(self._port, string_types):
                port_name = self._port
                port_number = get_port_number(port_name)
            else:
                raise ValueError('Cannot assign port name/number '
                        'based on port assignment type %r' % self._port)

            self._port = port_number
            self._portname = port_name or ''
919353
def add_attr(self, name, value):
        """"""
        setattr(self, name, value)
        self.attrs.append(name)
187542
def output_port(name)
      raise NoSuchPortError.new("output port \"#{name}\" not found") unless output_ports.has_key?(name)
      output_ports[name]
    end
834910
def validate_port(port):
    ''''''
    if not isinstance(port, (str, int)):
        raise TypeError(f'port must be an integer or string: {port}')
    if isinstance(port, str) and port.isdigit():
        port = int(port)
    if isinstance(port, int) and 0 < port <= 65535:
        return port
    raise ValueError(f'invalid port: {port}')
362266
def has_port_by_name(self, port_name):
        ''''''
        with self._mutex:
            if self.get_port_by_name(port_name):
                return True
            return False
1118718
def p_ports(self, p):
        ''
        wid = None
        port = Port(name=p[3], width=wid, type=None, lineno=p.lineno(1))
        p[0] = p[1] + (port,)
        p.set_lineno(0, p.lineno(1))
177425
def set_attr_value(self, key, attr, value):
        
        idx = self._keys[key]
        self._attrs[attr][idx].set(value)
605366
public void setAttribute(ObjectName name, String attrName, String value) throws Exception {
		MBeanAttributeInfo info = getAttrInfo(name, attrName);
		if (info == null) {
			throw new IllegalArgumentException("Cannot find attribute named '" + attrName + "'");
		} else {
			setAttribute(name, attrName, ClientUtils.stringToParam(value, info.getType()));
		}
	}
648510
def call_set_attr(node: Node, key: str, value):
    """"""
    node.set_attr(key, value)
698926
def _check_pool_attr(self, attr, req_attr=None):
        

        if req_attr is None:
            req_attr = []

        # check attribute names
        self._check_attr(attr, req_attr, _pool_attrs)

        # validate IPv4 prefix length
        if attr.get('ipv4_default_prefix_length') is not None:
            try:
                attr['ipv4_default_prefix_length'] = \
                    int(attr['ipv4_default_prefix_length'])

                if (attr['ipv4_default_prefix_length'] > 32 or
                    attr['ipv4_default_prefix_length'] < 1):
                    raise ValueError()
            except ValueError:
                raise NipapValueError('Default IPv4 prefix length must be an integer between 1 and 32.')

        # validate IPv6 prefix length
        if attr.get('ipv6_default_prefix_length'):
            try:
                attr['ipv6_default_prefix_length'] = \
                    int(attr['ipv6_default_prefix_length'])

                if (attr['ipv6_default_prefix_length'] > 128 or
                    attr['ipv6_default_prefix_length'] < 1):
                    raise ValueError()
            except ValueError:
                raise NipapValueError('Default IPv6 prefix length must be an integer between 1 and 128.')
649980
def port(self, value):
        

        self._port = value
        # If port is None we remove the element and don't write it to XML
        if value is None:
            try:
                del self._connectionXML.attrib['port']
            except KeyError:
                pass
        else:
            self._connectionXML.set('port', value)
361869
def set_access_port(self, port_number, vlan_id):
        

        if port_number not in self._nios:
            raise DynamipsError("Port {} is not allocated".format(port_number))

        nio = self._nios[port_number]
        yield from self._hypervisor.send('ethsw set_access_port "{name}" {nio} {vlan_id}'.format(name=self._name,
                                                                                                 nio=nio,
                                                                                                 vlan_id=vlan_id))

        log.info('Ethernet switch "{name}" [{id}]: port {port} set as an access port in VLAN {vlan_id}'.format(name=self._name,
                                                                                                               id=self._id,
                                                                                                               port=port_number,
                                                                                                               vlan_id=vlan_id))
        self._mappings[port_number] = ("access", vlan_id)
324108
function attr(name, value) {
    var self = this;
    if (arguments.length === 0) {
      return self._attrs;
    }
    if (Util.isObject(name)) {
      // self._attrs = Util.deepMix(self._attrs, name);
      for (var k in name) {
        this._setAttr(k, name[k]);
      }
      self.clearBBox();
      this._cfg.hasUpdate = true;
      return self;
    }
    if (arguments.length === 2) {
      this._setAttr(name, value);
      self.clearBBox();
      this._cfg.hasUpdate = true;
      return self;
    }
    return self._attrs[name];
  }
1230832
def input_port(name)
      raise NoSuchPortError.new("input port \"#{name}\" not found") unless input_ports.has_key?(name)
      input_ports[name]
    end
526700
def set_port_info(self, webport, mediaport, httpsport,
                                      onvifport, callback=None):
        '''
        
        '''
        params = {'webPort'   : webport,
                  'mediaPort' : mediaport,
                  'httpsPort' : httpsport,
                  'onvifPort' : onvifport,
                 }
        return self.execute_command('setPortInfo', params, callback=callback)
362321
def set_int_attribute(self, target, display_mask, attr, value):
    """"""
    reply = NVCtrlSetAttributeAndGetStatusReplyRequest(display=self.display,
                                                       opcode=self.display.get_extension_major(extname),
                                                       target_id=target.id(),
                                                       target_type=target.type(),
                                                       display_mask=display_mask,
                                                       attr=attr,
                                                       value=value)
    return reply._data.get('flags') != 0
1310921
def _set_attrs(self, attrs, allow_ro=False, from_json=True):
    
    for k, v in attrs.iteritems():
      attr = self._check_attr(k, allow_ro)
      if attr and from_json:
        v = attr.from_json(self._get_resource_root(), v)
      object.__setattr__(self, k, v)