class_docstr: Provide an opt-producer and CLI argument parser.
  
  Pseudo-extension of ``argparse`` which sets a number of parameters
  for the ParlAI framework. More options can be added specific to other
  modules by passing this object and calling ``add_arg()`` or
  ``add_argument()`` on it.
  
  For an example, see ``parlai.core.dict.DictionaryAgent.add_cmdline_args``.
  
  :param add_parlai_args:
      (default True) initializes the default arguments for ParlAI
      package, including the data download paths and task arguments.
  :param add_model_args:
      (default False) initializes the default arguments for loading
      models, including initializing arguments from that model.
class_docstr_tok: ["Provide","an","opt-producer","and","CLI","argument","parser",".","Pseudo-extension","of","``","argparse","``","which","sets","a","number","of","parameters","for","the","ParlAI","framework",".","More","options","can","be","added","specific","to","other","modules","by","passing","this","object","and","calling","``","add_arg","(",")","``","or","``","add_argument","(",")","``","on","it",".","For","an","example",",","see","``","parlai.core.dict.DictionaryAgent.add_cmdline_args","``",".",":","param","add_parlai_args",":","(","default","True",")","initializes","the","default","arguments","for","ParlAI","package",",","including","the","data","download","paths","and","task","arguments",".",":","param","add_model_args",":","(","default","False",")","initializes","the","default","arguments","for","loading","models",",","including","initializing","arguments","from","that","model","."]
docstr: Fixup argparse for parlai-style short args.
  
  In python 3.8, argparsing was changed such that short arguments are not
  required to have spaces after them. This causes our many short args to
  be misinterpetted by the parser. For example `-emb` gets parsed as
  `-e mb`.
  
  Here we rewrite them into long args to get around the nonsense.
docstr_tok: ["Fixup","argparse","for","parlai-style","short","args",".","In","python","3.8",",","argparsing","was","changed","such","that","short","arguments","are","not","required","to","have","spaces","after","them",".","This","causes","our","many","short","args","to","be","misinterpetted","by","the","parser",".","For","example","`","-emb","`","gets","parsed","as","`","-e","mb","`",".","Here","we","rewrite","them","into","long","args","to","get","around","the","nonsense","."]
code: def _handle_single_dash_addarg(self, args):
      """
      Fixup argparse for parlai-style short args.
  
      In python 3.8, argparsing was changed such that short arguments are not
      required to have spaces after them. This causes our many short args to
      be misinterpetted by the parser. For example `-emb` gets parsed as
      `-e mb`.
  
      Here we rewrite them into long args to get around the nonsense.
      """
      if _sys.version_info < (3, 8, 0):
          # older python works fine
          return args
  
      # need the long options specified first, or `dest` will get set to
      # the short name on accident!
      out_long = []
      out_short = []
      for arg in args:
          if arg.startswith("-") and not arg.startswith("--"):
              out_short.append(f"-{arg}")
          else:
              out_long.append(arg)
      # keep long args in front so they are used for the destination
      return out_long + out_short
  
imports: import argparse
  import importlib
  import os
  import sys
  import datetime
  import parlai
  import parlai.utils.logging
  from parlai.core.build_data import modelzoo_path
  from parlai.core.loader import load_teacher_module, load_agent_module, load_world_module
  from parlai.tasks.tasks import ids_to_tasks
  from parlai.core.opt import Opt
  from parlai.utils.io import PathManager
  from typing import List, Optional
label_desc: Use image node_id 29 for calling the ParlaiParser obj's underlying member method code with example usage: obj._handle_single_dash_addarg(args) and returns: unknown, args