prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Nicer failure mode for misuse of StoreInModule.
  See #389.
  
  > ...it's nonsensical to have no dots, but something one might accidentally do if you forget to do the %s/name business, maybe throw in a quick format check on the inputs of add_argument() to fail-fast rather than raise an obscure error here?
  > @grybmadsci
  
  Document util/argv.py
  There are no docs on how to use this module.
  
  
  </issue>
  <code>
  [start of openhtf/util/argv.py]
  1 """Utilities for handling command line arguments.
  2 
  3 StoreInModule:
  4   Enables emulating a gflags-esque API (flag affects global value), but one
  5   doesn't necessarily need to use flags to set values.
  6   
  7   Example usage:
  8     DEFAULT_VALUE = 0
  9     ARG_PARSER = argv.ModuleParser()
  10     ARG_PARSER.add_argument(
  11         '--override-value', action=argv.StoreInModule,
  12         default=DEFAULT_VALUE, target='%s.DEFAULT_VALUE' % __name__)
  13 
  14   Then in an entry point (main() function), use that parser as a parent:
  15     parser = argparse.ArgumentParser(parents=[other_module.ARG_PARSER])
  16     parser.parse_args()
  17 """
  18 
  19 import argparse
  20 
  21 
  22 def ModuleParser():
  23     return argparse.ArgumentParser(add_help=False)
  24 
  25 
  26 class StoreInModule(argparse.Action):
  27 
  28     def __init__(self, *args, **kwargs):
  29         self._tgt_mod, self._tgt_attr = kwargs.pop('target').rsplit('.', 1)
  30         proxy_cls = kwargs.pop('proxy', None)
  31         if proxy_cls is not None:
  32             self._proxy = proxy_cls(*args, **kwargs)
  33         super(StoreInModule, self).__init__(*args, **kwargs)
  34 
  35     def __call__(self, parser, namespace, values, option_string=None):
  36         if hasattr(self, '_proxy'):
  37             values = self._proxy(parser, namespace, values)
  38         base, mod = self._tgt_mod.rsplit('.', 1)
  39         module = getattr(__import__(base, fromlist=[mod]), mod)
  40         setattr(module, self._tgt_attr, values)
  41 
  42
  [end of openhtf/util/argv.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/openhtf/util/argv.py b/openhtf/util/argv.py
  --- a/openhtf/util/argv.py
  +++ b/openhtf/util/argv.py
  @@ -35,7 +35,10 @@
       def __call__(self, parser, namespace, values, option_string=None):
           if hasattr(self, '_proxy'):
               values = self._proxy(parser, namespace, values)
  -        base, mod = self._tgt_mod.rsplit('.', 1)
  -        module = getattr(__import__(base, fromlist=[mod]), mod)
  +        if '.' in self._tgt_mod:
  +          base, mod = self._tgt_mod.rsplit('.', 1)
  +          module = getattr(__import__(base, fromlist=[mod]), mod)
  +        else:
  +          module = __import__(self._tgt_mod)
           setattr(module, self._tgt_attr, values)
  
verification_info: {"golden_diff": "diff --git a/openhtf/util/argv.py b/openhtf/util/argv.py\n--- a/openhtf/util/argv.py\n+++ b/openhtf/util/argv.py\n@@ -35,7 +35,10 @@\n     def __call__(self, parser, namespace, values, option_string=None):\n         if hasattr(self, '_proxy'):\n             values = self._proxy(parser, namespace, values)\n-        base, mod = self._tgt_mod.rsplit('.', 1)\n-        module = getattr(__import__(base, fromlist=[mod]), mod)\n+        if '.' in self._tgt_mod:\n+          base, mod = self._tgt_mod.rsplit('.', 1)\n+          module = getattr(__import__(base, fromlist=[mod]), mod)\n+        else:\n+          module = __import__(self._tgt_mod)\n         setattr(module, self._tgt_attr, values)\n", "issue": "Nicer failure mode for misuse of StoreInModule.\nSee #389.\n\n> ...it's nonsensical to have no dots, but something one might accidentally do if you forget to do the %s/name business, maybe throw in a quick format check on the inputs of add_argument() to fail-fast rather than raise an obscure error here?\n> @grybmadsci\n\nDocument util/argv.py\nThere are no docs on how to use this module.\n\n", "before_files": [{"content": "\"\"\"Utilities for handling command line arguments.\n\nStoreInModule:\n  Enables emulating a gflags-esque API (flag affects global value), but one\n  doesn't necessarily need to use flags to set values.\n  \n  Example usage:\n    DEFAULT_VALUE = 0\n    ARG_PARSER = argv.ModuleParser()\n    ARG_PARSER.add_argument(\n        '--override-value', action=argv.StoreInModule,\n        default=DEFAULT_VALUE, target='%s.DEFAULT_VALUE' % __name__)\n\n  Then in an entry point (main() function), use that parser as a parent:\n    parser = argparse.ArgumentParser(parents=[other_module.ARG_PARSER])\n    parser.parse_args()\n\"\"\"\n\nimport argparse\n\n\ndef ModuleParser():\n    return argparse.ArgumentParser(add_help=False)\n\n\nclass StoreInModule(argparse.Action):\n\n    def __init__(self, *args, **kwargs):\n        self._tgt_mod, self._tgt_attr = kwargs.pop('target').rsplit('.', 1)\n        proxy_cls = kwargs.pop('proxy', None)\n        if proxy_cls is not None:\n            self._proxy = proxy_cls(*args, **kwargs)\n        super(StoreInModule, self).__init__(*args, **kwargs)\n\n    def __call__(self, parser, namespace, values, option_string=None):\n        if hasattr(self, '_proxy'):\n            values = self._proxy(parser, namespace, values)\n        base, mod = self._tgt_mod.rsplit('.', 1)\n        module = getattr(__import__(base, fromlist=[mod]), mod)\n        setattr(module, self._tgt_attr, values)\n\n", "path": "openhtf/util/argv.py"}]}