Sets the current path to watch for new events.

    This also records the size of the old path, if any. If the size can't be
    found, an error is logged.

    Args:
      path: The full path of the file to watch.
504077
def _SetPath(self, path):
    
    old_path = self._path
    if old_path and not io_wrapper.IsCloudPath(old_path):
      try:
        # We're done with the path, so store its size.
        size = tf.io.gfile.stat(old_path).length
        logger.debug('Setting latest size of %s to %d', old_path, size)
        self._finalized_sizes[old_path] = size
      except tf.errors.OpError as e:
        logger.error('Unable to get size of %s: %s', old_path, e)

    self._path = path
    self._loader = self._loader_factory(path)
242574
private synchronized WatchKey getWatchKeyForPath(final String path) throws IOException {
        WatchKey key = watchKeysByPath.get(path);
        if (key == null) {
            logger.debug("Lazy-instantiating watch key for path: {}", path);
            key = Paths.get(path).register(watchService, interested_types);
            watchKeysByPath.put(path, key);
            pathsByWatchKey.put(key, path);
            listenersByWatchKey.put(key, Collections.newSetFromMap(new ConcurrentHashMap<SFMF4JWatchListener, Boolean>()));
        }
        return key;
    }
705955
def add_path(self, path):
        

        if os.path.exists(path):
            self.paths.add(path)
            return path
        else:
            #logger.debug('Path {} doesn\'t exist'.format(path))
            return None
70005
def load_path(self, path):
        

        if not foundations.common.path_exists(path):
            return False

        if os.path.isfile(path):
            if path in self.list_files():
                self.set_current_editor(path)
            else:
                self.load_file(path)
        else:
            if not path in self.list_projects():
                self.add_project(path)
        return True
1007753
def set_own_module(self, path):
        
        log = self._params.get('log', self._discard)
        self._name = path
        self.module_add(event_target(self, 'legion_reset', key=path, log=log), path)
1200468
def post(self, *args):
        
        filepath = self.get_body_argument('filepath')
        if not self.fs.exists(filepath):
            raise tornado.web.HTTPError(404)

        Filewatcher.add_directory_to_watch(filepath)
        self.write({'msg':'Watcher added for {}'.format(filepath)})
496381
def create_path(path):
    
    import os
    if not os.path.exists(path):
        os.makedirs(path)
1134690
def expand_path(path):
  
  return os.path.abspath(os.path.expandvars(os.path.expanduser(path)))
1131728
def pushPath(self, path):
        
        # normalize the path
        path = os.path.normcase(nstr(path)).strip()
        if path and path != '.' and path not in sys.path:
            sys.path.append(path)
            self._addedpaths.insert(0, path)
            return True
        return False
597686
def set_path(self, path):
        ''''''
        self._path = path
        return self._listitem.setPath(path)
45070
public void setPath(String path) {
        this.path = path;
        if (null != path) {
            int i = path.lastIndexOf('.');
            if (i == path.length() - 4) {
                i = path.lastIndexOf('/');
                String p = path.substring(0, i);
                String f = path.substring(i + 1);
                recorder.setPath(p);
                recorder.setName(f);
            } else {
                recorder.setPath(path);
                //recorder.setName(VoiceRecorder.generateName());
            }
        }
    }
24273
def run_process(path: Union[Path, str], target: Callable, *,
                args: Tuple=(),
                kwargs: Dict[str, Any]=None,
                callback: Callable[[Set[Tuple[Change, str]]], None]=None,
                watcher_cls: Type[AllWatcher]=PythonWatcher,
                debounce=400,
                min_sleep=100):
    

    process = _start_process(target=target, args=args, kwargs=kwargs)
    reloads = 0

    for changes in watch(path, watcher_cls=watcher_cls, debounce=debounce, min_sleep=min_sleep):
        callback and callback(changes)
        _stop_process(process)
        process = _start_process(target=target, args=args, kwargs=kwargs)
        reloads += 1
    return reloads
318107
def setBundlePath(path):
    
    if os.path.exists(path):
        Settings.BundlePath = path
    else:
        raise OSError("File not found: " + path)
941515
private void traverse(final Path path, final boolean watch, final boolean remove) {
		log.debug("traverse start. path : {}, watch : {}, remove : {}", path, watch, remove);
		if (Files.notExists(path)) {
			return;
		}
		if (Files.isDirectory(path)) {
			if (validPath(path)) {
				try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) {
					if (watch) {
						WatchKey key = path.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
						watchDirs.put(key, path);
					}
					for (Path child : ds) {
						traverse(child, watch, remove);
					}
				} catch (IOException ex) {
					throw new UroborosqlRuntimeException("I/O error occured.", ex);
				}
			}
		} else if (path.toString().endsWith(fileExtension)) {
			String sqlName = getSqlName(path);
			this.sqlInfos.compute(sqlName,
					(k, v) -> v == null ? new SqlInfo(sqlName, path, dialect, charset) : v.computePath(path, remove));
		}
	}
1306162
def path(self, path: str):
        

        path = path if path else ''
        self.pathName = os.path.join(path, self.name)
1217360
def set(self, path, data):
        
        return self._zk.set(self.__path(path), data)
1198480
def watch_project(self, path):
    
    # TODO(kwlzn): Add a client.query(timeout=X) param to the upstream pywatchman project.
    try:
      return self.client.query('watch-project', os.path.realpath(path))
    finally:
      self._attempt_set_timeout(self._timeout)