Return the string URI for the location of the pull and pub sockets to
        use for firing and listening to events
335787
def __load_uri(self, sock_dir, node):
        '''
        
        '''
        if node == 'master':
            if self.opts['ipc_mode'] == 'tcp':
                puburi = int(self.opts['tcp_master_pub_port'])
                pulluri = int(self.opts['tcp_master_pull_port'])
            else:
                puburi = os.path.join(
                    sock_dir,
                    'master_event_pub.ipc'
                )
                pulluri = os.path.join(
                    sock_dir,
                    'master_event_pull.ipc'
                )
        else:
            if self.opts['ipc_mode'] == 'tcp':
                puburi = int(self.opts['tcp_pub_port'])
                pulluri = int(self.opts['tcp_pull_port'])
            else:
                hash_type = getattr(hashlib, self.opts['hash_type'])
                # Only use the first 10 chars to keep longer hashes from exceeding the
                # max socket path length.
                id_hash = hash_type(salt.utils.stringutils.to_bytes(self.opts['id'])).hexdigest()[:10]
                puburi = os.path.join(
                    sock_dir,
                    'minion_event_{0}_pub.ipc'.format(id_hash)
                )
                pulluri = os.path.join(
                    sock_dir,
                    'minion_event_{0}_pull.ipc'.format(id_hash)
                )
        log.debug('%s PUB socket URI: %s', self.__class__.__name__, puburi)
        log.debug('%s PULL socket URI: %s', self.__class__.__name__, pulluri)
        return puburi, pulluri
332180
private Uri getUri(String string) {
        return Uri.parse(OfflinerProvider.CONTENT + OfflinerProvider.getAuthority(mPackageName)
                + OfflinerProvider.SLASH + string);
    }
535387
def geturi(self):
        """"""
        fragment = self.fragment
        if fragment is None:
            return self.uri
        elif isinstance(fragment, bytes):
            return self.uri + b'#' + fragment
        else:
            return self.uri + u'#' + fragment
873510
def uri(self):
        """"""
        if self._uds_path:
            uri = 'mongodb://%s' % (quote_plus(self._uds_path),)
        else:
            uri = 'mongodb://%s' % (format_addr(self._address),)
        return uri + '/?ssl=true' if self._ssl else uri
358624
def get(uri, opts = {}, &block)
      initialize_socket(uri, opts)
      HttpStream::get(uri, opts, &block)
    rescue IOError => e
      raise e unless @intentional_termination
    end
145091
private String serverUrl() {
        if (context.containsKey(AgentBootstrapperArgs.SERVER_URL)) {
            return (String) context.get(AgentBootstrapperArgs.SERVER_URL);
        } else {
            return "http://" + context.get("hostname") + ":" + context.get("port") + "/go";
        }
    }
1072640
def parse_wsgi_bind_location(bind_addr_string):
    """"""
    # try and match for an IP/hostname and port
    match = six.moves.urllib.parse.urlparse('//{}'.format(bind_addr_string))
    try:
        addr = match.hostname
        port = match.port
        if addr is not None or port is not None:
            return TCPSocket(addr, port)
    except ValueError:
        pass

    # else, assume a UNIX socket path
    # if the string begins with an @ symbol, use an abstract socket
    if bind_addr_string.startswith('@'):
        return AbstractSocket(bind_addr_string[1:])
    return UnixSocket(path=bind_addr_string)
421245
def get_root_uri(uri):
    """"""
    chunks = urlsplit(uri)
    return urlunsplit((chunks.scheme, chunks.netloc, chunks.path, '', ''))
962320
def _maybe_location(cls, response, uri=None):
        
        location = response.headers.getRawHeaders(b'location', [None])[0]
        if location is not None:
            return location.decode('ascii')
        return uri
224876
private static String getPUBURIAsString() {
        String pubUri = JanusConfig.getSystemProperty(JanusConfig.PUB_URI);
        if (pubUri == null || pubUri.isEmpty()) {
            InetAddress a = NetworkUtil.getPrimaryAddress();
            if (a == null) {
                a = NetworkUtil.getLoopbackAddress();
            }
            if (a != null) {
                pubUri = NetworkUtil.toURI(a, -1).toString();
                System.setProperty(JanusConfig.PUB_URI, pubUri);
            }
        }
        return pubUri;
    }
966940
private String getWebSocketURL(HttpRequest req) {
        String protocol = Constants.WS_SCHEME;
        if (secureConnection) {
            protocol = Constants.WSS_SCHEME;
        }
        return protocol + "://" + req.headers().get("Host") + req.uri();
    }
278949
def resource_uri(self):
        
        primary_key_value = getattr(self, self.primary_key(), None)
        return '/{}/{}'.format(self.endpoint(), primary_key_value)
758800
def _get_resource_uri(self, guid=None):
        
        uri = self.uri + '/v1/resource'
        if guid:
            uri += '/' + urllib.quote_plus(guid)
        return uri
352112
def geturi(self, key, **kwargs):
        

        return self.get(key, cast_func=urlparse, **kwargs)
301298
def uri(self):
        """"""
        val = _fitz.Outline_uri(self)

        if val:
            nval = "".join([c for c in val if 32 <= ord(c) <= 127])
            val = nval
        else:
            val = ""


        return val
1187763
function find() {
      // If there is no remaining URI, fires `error` and `close` event as it means that all
      // tries failed.
      if (uris.length === 0) {
        // Now that `connecting` event is being fired, there is no `error` and `close` event user
        // added. Delays to fire them a little while.
        setTimeout(function() {
          self.emit("error", new Error());
          self.emit("close");
        }, 0);
        return;
      }
      // A temporal variable to be used while finding working one.
      var testTransport;
      // Get the first uri by removing it from `uris`. For example, `[1,2].shift()` returns `1`
      // and make the array `[2]`.
      var uri = uris.shift();
      // Transport handles only the specific types of URIs. It finds which transport factory can
      // handle this `uri` among ones specified by `transports` option.
      for (var i = 0; i < options.transports.length; i++) {
        // A transport factory creates and returns a transport object if it can handle the given
        // URI and nothing if not.
        testTransport = options.transports[i](uri, options);
        // If the factory handles this type of URI,
        if (testTransport) {
          break;
        }
      }
      // If there is no transport matching with the given URI, try with the next URI.
      if (!testTransport) {
        find();
        return;
      }
      // This is to stop the whole process to find a working transport when the `close` method
      // is called before `open` event.
      function stop() {
        testTransport.removeListener("close", find);
        testTransport.close();
      }

      // Until the socket is opened, `close` method should trigger `stop` function as well.
      self.once("close", stop);
      // It establishes a connection.
      testTransport.open();
      // If it fails, it should remove stop listener and try with the next URI. These event handlers
      // will be removed once this transport is recognized as working.
      testTransport.on("close", function() {
        self.removeListener("close", stop);
      });
      testTransport.on("close", find);
      // Node.js kills the process by default when an `error` event is fired if there is no
      // listener for it. However, a user doesn't need to be notified of an error from this
      // transport being tested.
      testTransport.on("error", function() {
      });
      // If it succeeds, it means that the process to find working transport is done. The first
      // transport text message is used to handshake the socket protocol. Note that `once`
      // registers one-time event handler.
      testTransport.once("text", function(text) {
        // The handshake output is in the form of URI. Query params starting with `cettia-`
        // represent protocol header.
        var headers = url.parse(text, true).query;
        // The server prints an id of the socket as a `cettia-id` param, `id` header,
        // every time the transport connects. If the server issues a new id,
        if (id !== headers["cettia-id"]) {
          // That means there was no `id` or the server socket whose id is `id` was deleted in
          // the server due to long-term disconnection.
          id = headers["cettia-id"];
          // Fires a `new` event as a new socket is created.
          self.emit("new");
        }

        // To maintain an alive connection, `heartbeat` is used.
        options.heartbeat = +headers["cettia-heartbeat"];
        // `_heartbeat` is for testing so it should be not passed from the server in production.
        // The default value is `5000`.
        options._heartbeat = +headers["cettia-_heartbeat"] || 5000;
        // Now that the working transport is found and handshaking is completed, it stops
        // a process to find a working transport by removing `close` event handler `find` and
        // associates the working transport with the socket.
        testTransport.removeListener("close", find);
        transport = testTransport;

        // When an event object is created from `text` or `binary` event,
        function onevent(event) {
          // Event should have the following properties:
          // * `id: string`: an event identifier.
          // * `type: string`: an event type.
          // * `data: any`: an event data.
          // * `reply: boolean`: `true` if this event requires the reply.

          // If the server sends a plain event, dispatch it.
          if (!event.reply) {
            self.emit(event.type, event.data);
          } else {
            var latch;
            // A function to create a function.
            function reply(success) {
              // A controller function.
              return function(value) {
                // This latch prevents double reply.
                if (!latch) {
                  latch = true;
                  self.send("reply", {id: event.id, data: value, exception: !success});
                }
              };
            }

            // Here, the controller is passed to the event handler as 2nd argument and
            // allows to call the server's `resolved` or `rejected` callback by sending
            // `reply` event.
            self.emit(event.type, event.data, {resolve: reply(true), reject: reply(false)});
          }
        }

        // When the transport has received a text message from the server,
        // it deserializes a text message into an event object in the JSON format and deals with it.
        transport.on("text", function(text) {
          onevent(JSON.parse(text));
        });
        // When the transport has received a binary message from the server.
        // it deserializes a binary message into an event object in the
        // [MessagePack](http://msgpack.org) format and deals with it.
        transport.on("binary", function(binary) {
          onevent(msgpack.decode(binary));
        });
        // When any error has occurred.
        transport.on("error", function(error) {
          self.emit("error", error);
        });
        // When the transport has been closed for any reason.
        transport.on("close", function() {
          self.emit("close");
        });
        // Now that the working transport is associated and the communication is possible,
        // it removes `close` event handler `stop` and fires `open` event.
        self.removeListener("close", stop);
        self.emit("open");
      });
    }
1317666
function getUri() {
  const startPos = pos;
  const uriExcluding = {};
  let uri;
  let token;
  let l;
  let raw;

  pos += 2;

  uriExcluding[TokenType.Space] = 1;
  uriExcluding[TokenType.Tab] = 1;
  uriExcluding[TokenType.Newline] = 1;
  uriExcluding[TokenType.LeftParenthesis] = 1;
  uriExcluding[TokenType.RightParenthesis] = 1;

  if (checkUri1(pos)) {
    uri = []
        .concat(getSC())
        .concat([getString()])
        .concat(getSC());
  } else {
    uri = getSC();
    l = checkExcluding(uriExcluding, pos);
    token = tokens[pos];
    raw = newNode(NodeType.RawType, joinValues(pos, pos + l), token.ln,
        token.col);

    uri.push(raw);

    pos += l + 1;

    uri = uri.concat(getSC());
  }

  token = tokens[startPos];
  const line = token.ln;
  const column = token.col;
  const end = getLastPosition(uri, line, column, 1);
  pos++;

  return newNode(NodeType.UriType, uri, line, column, end);
}