MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ParseURI

Function ParseURI

tensorflow/core/lib/io/path.cc:228–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void ParseURI(StringPiece remaining, StringPiece* scheme, StringPiece* host,
229 StringPiece* path) {
230 // 0. Parse scheme
231 // Make sure scheme matches [a-zA-Z][0-9a-zA-Z.]*
232 // TODO(keveman): Allow "+" and "-" in the scheme.
233 // Keep URI pattern in tensorboard/backend/server.py updated accordingly
234 if (!strings::Scanner(remaining)
235 .One(strings::Scanner::LETTER)
236 .Many(strings::Scanner::LETTER_DIGIT_DOT)
237 .StopCapture()
238 .OneLiteral("://")
239 .GetResult(&remaining, scheme)) {
240 // If there's no scheme, assume the entire string is a path.
241 *scheme = StringPiece(remaining.begin(), 0);
242 *host = StringPiece(remaining.begin(), 0);
243 *path = remaining;
244 return;
245 }
246
247 // 1. Parse host
248 if (!strings::Scanner(remaining).ScanUntil('/').GetResult(&remaining, host)) {
249 // No path, so the rest of the URI is the host.
250 *host = remaining;
251 *path = StringPiece(remaining.end(), 0);
252 return;
253 }
254
255 // 2. The rest is the path
256 *path = remaining;
257}
258
259string CreateURI(StringPiece scheme, StringPiece host, StringPiece path) {
260 if (scheme.empty()) {

Callers 15

_ParseOSSURIPathMethod · 0.85
TranslateNameMethod · 0.85
SplitPathFunction · 0.85
GetFileSystemForFileMethod · 0.85
FilesExistMethod · 0.85
RecursivelyCreateDirMethod · 0.85
FileExistsMethod · 0.85
CreateDirMethod · 0.85
ParsePathMethod · 0.85
ParseGcsPathFunction · 0.85
TranslateNameMethod · 0.85

Calls 5

ScannerClass · 0.85
GetResultMethod · 0.45
OneMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 4

FileExistsMethod · 0.68
CreateDirMethod · 0.68
ParsePathMethod · 0.68