code: def __init__(self, args: Namespace) -> None:
      self.repo_id: str = args.repo_id
      self.repo_type: Optional[str] = args.repo_type
      self.revision: Optional[str] = args.revision
      self.private: bool = args.private
  
      self.include: Optional[List[str]] = args.include
      self.exclude: Optional[List[str]] = args.exclude
      self.delete: Optional[List[str]] = args.delete
  
      self.commit_message: Optional[str] = args.commit_message
      self.commit_description: Optional[str] = args.commit_description
      self.create_pr: bool = args.create_pr
      self.api: HfApi = HfApi(
          token=args.token, library_name="huggingface-cli"
      )
      self.quiet: bool = (
          args.quiet
      )  # disable warnings and progress bars
  
      # Check `--every` is valid
      if args.every is not None and args.every <= 0:
          raise ValueError(
              f"`every` must be a positive value (got '{args.every}')"
          )
      self.every: Optional[float] = args.every
  
      # Resolve `local_path` and `path_in_repo`
      repo_name: str = args.repo_id.split("/")[
          -1
      ]  # e.g. "Wauplin/my-cool-model" => "my-cool-model"
      self.local_path: str
      self.path_in_repo: str
      if args.local_path is None and os.path.isfile(repo_name):
          # Implicit case 1: user provided only a repo_id which happen to be a local file as well => upload it with same name
          self.local_path = repo_name
          self.path_in_repo = repo_name
      elif args.local_path is None and os.path.isdir(repo_name):
          # Implicit case 2: user provided only a repo_id which happen to be a local folder as well => upload it at root
          self.local_path = repo_name
          self.path_in_repo = "."
      elif args.local_path is None:
          # Implicit case 3: user provided only a repo_id that does not match a local file or folder
          # => the user must explicitly provide a local_path => raise exception
          raise ValueError(
              f"'{repo_name}' is not a local file or folder. Please set `local_path` explicitly."
          )
      elif args.path_in_repo is None and os.path.isfile(
          args.local_path
      ):
          # Explicit local path to file, no path in repo => upload it at root with same name
          self.local_path = args.local_path
          self.path_in_repo = os.path.basename(args.local_path)
      elif args.path_in_repo is None:
          # Explicit local path to folder, no path in repo => upload at root
          self.local_path = args.local_path
          self.path_in_repo = "."
      else:
          # Finally, if both paths are explicit
          self.local_path = args.local_path
          self.path_in_repo = args.path_in_repo
  
file_path: hub-client/src/huggingface_hub/commands/upload.py
imports: import os
  import time
  import warnings
  from argparse import Namespace, _SubParsersAction
  from typing import List, Optional
  from huggingface_hub import logging
  from huggingface_hub._commit_scheduler import CommitScheduler
  from huggingface_hub.commands import BaseHuggingfaceCLICommand
  from huggingface_hub.constants import HF_HUB_ENABLE_HF_TRANSFER
  from huggingface_hub.hf_api import HfApi
  from huggingface_hub.utils import RevisionNotFoundError, disable_progress_bars, enable_progress_bars
label_desc: Use image node_id 2 to create a new UploadCommand object from inherited base classes: BaseHuggingfaceCLICommand with example: obj = UploadCommand(args)