code: def sync(
      path: Path,
      object_names: List[str],
      project_name: Optional[str],
      offline_only: Optional[bool],
  ) -> None:
      """Synchronizes objects with unsent data to the server.
  
       Neptune stores object data on disk in the '.neptune' directory. If an object executes offline
      or if the network is unavailable as the run executes,  the object data can be synchronized
      with the server with this command line utility.
  
      You can list unsynchronized runs with `neptune status`
  
      Examples:
  
      \b
      # Synchronize all objects in the current directory
      neptune sync
  
      \b
      # Synchronize all objects in the given path
      neptune sync --path foo/bar
  
      \b
      # Synchronize only runs "NPT-42" and "NPT-43" in "workspace/project" in the current directory
      neptune sync --object workspace/project/NPT-42 --object workspace/project/NPT-43
  
      \b
      # Synchronise all objects in the current directory, sending offline runs to project "workspace/project"
      neptune sync --project workspace/project
  
      \b
      # Synchronize only the offline run with UUID offline/a1561719-b425-4000-a65a-b5efb044d6bb
      # to project "workspace/project"
      neptune sync --project workspace/project --object offline/a1561719-b425-4000-a65a-b5efb044d6bb
  
      \b
      # Synchronize only the offline runs
      neptune sync --offline-only
  
      \b
      # Synchronize only the offline runs to project "workspace/project"
      neptune sync --project workspace/project --offline-only
      """
  
      backend = HostedNeptuneBackend(Credentials.from_token())
      sync_runner = SyncRunner(backend=backend)
  
      if offline_only:
          if object_names:
              raise click.BadParameter(
                  "--object and --offline-only are mutually exclusive"
              )
  
          if project_name is not None:
              sync_runner.sync_all_offline_containers(
                  base_path=path,
                  project_name=QualifiedName(project_name),
              )
  
      elif object_names:
          sync_runner.sync_selected_containers(
              path, project_name, object_names
          )
      else:
          sync_runner.sync_all_containers(path, project_name)
  
      clear_runner = ClearRunner(backend=backend)
  
      clear_runner.clear(path, clear_eventual=False)
  
file_path: neptune-client/src/neptune/cli/commands.py
imports: from pathlib import Path
  from typing import List, Optional
  import click
  from neptune.cli.clear import ClearRunner
  from neptune.cli.path_option import path_option
  from neptune.cli.status import StatusRunner
  from neptune.cli.sync import SyncRunner
  from neptune.common.exceptions import NeptuneException
  from neptune.exceptions import CannotSynchronizeOfflineRunsWithoutProject, ProjectNotFound, RunNotFound
  from neptune.internal.backends.api_model import ApiExperiment, Project
  from neptune.internal.backends.hosted_neptune_backend import HostedNeptuneBackend
  from neptune.internal.backends.neptune_backend import NeptuneBackend
  from neptune.internal.credentials import Credentials
  from neptune.internal.disk_queue import DiskQueue
  from neptune.internal.id_formats import QualifiedName
  from neptune.internal.operation import Operation
label_desc: Use image node_id 2 for calling a global function with example usage: sync(path, object_names, project_name, offline_only) without return types