
def convert_arg_line_to_args(arg_line):
    """argparse helper for splitting input from config

    Allows comment lines in configfiles and allows both argument and
    value on the same line
    """
    if arg_line.strip().startswith('#'):
        return []
    else:
        return arg_line.split()


import shlex

def convert_arg_line_to_args(arg_line):
    """argparse helper for splitting input from config

    Allows comment lines in configfiles and allows both argument and
    value on the same line
    """
    return shlex.split(arg_line, comments=True)

Improve config argument splitting to allow quoted spaces
Improve config argument splitting to allow quoted spaces

+ 
+ import shlex
  
  def convert_arg_line_to_args(arg_line):
      """argparse helper for splitting input from config
  
      Allows comment lines in configfiles and allows both argument and
      value on the same line
      """
+     return shlex.split(arg_line, comments=True)
-     if arg_line.strip().startswith('#'):
-         return []
-     else:
-         return arg_line.split()
  
Improve config argument splitting to allow quoted spaces
## Code Before:

def convert_arg_line_to_args(arg_line):
    """argparse helper for splitting input from config

    Allows comment lines in configfiles and allows both argument and
    value on the same line
    """
    if arg_line.strip().startswith('#'):
        return []
    else:
        return arg_line.split()

## Instruction:
Improve config argument splitting to allow quoted spaces
## Code After:

import shlex

def convert_arg_line_to_args(arg_line):
    """argparse helper for splitting input from config

    Allows comment lines in configfiles and allows both argument and
    value on the same line
    """
    return shlex.split(arg_line, comments=True)
