prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Transitive import of mitmproxy.version causes warning
  Since #1837, we import `.script`, will imports `.flow`, which imports `.version`.
  This causes the following warning in pytest:
  
  ```
  test/mitmproxy/test_version.py::test_version
    /Users/kriechi/.pyenv/versions/3.5.3/lib/python3.5/runpy.py:125: 
  RuntimeWarning: 'mitmproxy.version' found in sys.modules after import of package 
  'mitmproxy', but prior to execution of 'mitmproxy.version'; this may result in 
  unpredictable behaviour
      warn(RuntimeWarning(msg))
  
  -- Docs: http://doc.pytest.org/en/latest/warnings.html
  ```
  
  [Note](http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-double-import-trap)
  > This next trap exists in all current versions of Python, including 3.3, and can be summed up in the following general guideline: “Never add a package directory, or any directory inside a package, directly to the Python path”.
  
  > The reason this is problematic is that every module in that directory is now potentially accessible under two different names: as a top level module (since the directory is on sys.path) and as a submodule of the package (if the higher level directory containing the package itself is also on sys.path).
  
  Maybe using the approach described [here](https://stackoverflow.com/questions/27947639/how-to-properly-create-a-pyinstaller-hook-or-maybe-hidden-import) works better?
  
  </issue>
  <code>
  [start of mitmproxy/version.py]
  1 import os
  2 import subprocess
  3 
  4 # The actual version string. For precompiled binaries, this will be changed to include the build
  5 # tag, e.g. "3.0.0.dev0042-0xcafeabc"
  6 VERSION = "3.0.0"
  7 PATHOD = "pathod " + VERSION
  8 MITMPROXY = "mitmproxy " + VERSION
  9 
  10 # Serialization format version. This is displayed nowhere, it just needs to be incremented by one
  11 # for each change in the file format.
  12 FLOW_FORMAT_VERSION = 5
  13 
  14 
  15 def get_version(dev: bool = False, build: bool = False, refresh: bool = False) -> str:
  16     """
  17     Return a detailed version string, sourced either from a hardcoded VERSION constant
  18     or obtained dynamically using git.
  19 
  20     Args:
  21         dev: If True, non-tagged releases will include a ".devXXXX" suffix, where XXXX is the number
  22              of commits since the last tagged release.
  23         build: If True, non-tagged releases will include a "-0xXXXXXXX" suffix, where XXXXXXX are
  24                the first seven digits of the commit hash.
  25         refresh: If True, always try to use git instead of a potentially hardcoded constant.
  26     """
  27 
  28     mitmproxy_version = VERSION
  29 
  30     if "dev" in VERSION and not refresh:
  31         pass  # There is a hardcoded build tag, so we just use what's there.
  32     elif dev or build:
  33         here = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
  34         try:
  35             git_describe = subprocess.check_output(
  36                 ['git', 'describe', '--tags', '--long'],
  37                 stderr=subprocess.STDOUT,
  38                 cwd=here,
  39             )
  40             last_tag, tag_dist, commit = git_describe.decode().strip().rsplit("-", 2)
  41             commit = commit.lstrip("g")[:7]
  42             tag_dist = int(tag_dist)
  43         except Exception:
  44             pass
  45         else:
  46             # Remove current suffix
  47             mitmproxy_version = mitmproxy_version.split(".dev")[0]
  48 
  49             # Add suffix for non-tagged releases
  50             if tag_dist > 0:
  51                 mitmproxy_version += ".dev{tag_dist}".format(tag_dist=tag_dist)
  52                 # The wheel build tag (we use the commit) must start with a digit, so we include "0x"
  53                 mitmproxy_version += "-0x{commit}".format(commit=commit)
  54 
  55     if not dev:
  56         mitmproxy_version = mitmproxy_version.split(".dev")[0]
  57     elif not build:
  58         mitmproxy_version = mitmproxy_version.split("-0x")[0]
  59 
  60     return mitmproxy_version
  61 
  62 
  63 if __name__ == "__main__":
  64     print(VERSION)
  65
  [end of mitmproxy/version.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/mitmproxy/version.py b/mitmproxy/version.py
  --- a/mitmproxy/version.py
  +++ b/mitmproxy/version.py
  @@ -60,5 +60,5 @@
       return mitmproxy_version
   
   
  -if __name__ == "__main__":
  +if __name__ == "__main__":  # pragma: no cover
       print(VERSION)
  
verification_info: {"golden_diff": "diff --git a/mitmproxy/version.py b/mitmproxy/version.py\n--- a/mitmproxy/version.py\n+++ b/mitmproxy/version.py\n@@ -60,5 +60,5 @@\n     return mitmproxy_version\n \n \n-if __name__ == \"__main__\":\n+if __name__ == \"__main__\":  # pragma: no cover\n     print(VERSION)\n", "issue": "Transitive import of mitmproxy.version causes warning\nSince #1837, we import `.script`, will imports `.flow`, which imports `.version`.\r\nThis causes the following warning in pytest:\r\n\r\n```\r\ntest/mitmproxy/test_version.py::test_version\r\n  /Users/kriechi/.pyenv/versions/3.5.3/lib/python3.5/runpy.py:125: \r\nRuntimeWarning: 'mitmproxy.version' found in sys.modules after import of package \r\n'mitmproxy', but prior to execution of 'mitmproxy.version'; this may result in \r\nunpredictable behaviour\r\n    warn(RuntimeWarning(msg))\r\n\r\n-- Docs: http://doc.pytest.org/en/latest/warnings.html\r\n```\r\n\r\n[Note](http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-double-import-trap)\r\n> This next trap exists in all current versions of Python, including 3.3, and can be summed up in the following general guideline: \u201cNever add a package directory, or any directory inside a package, directly to the Python path\u201d.\r\n\r\n> The reason this is problematic is that every module in that directory is now potentially accessible under two different names: as a top level module (since the directory is on sys.path) and as a submodule of the package (if the higher level directory containing the package itself is also on sys.path).\r\n\r\nMaybe using the approach described [here](https://stackoverflow.com/questions/27947639/how-to-properly-create-a-pyinstaller-hook-or-maybe-hidden-import) works better?\n", "before_files": [{"content": "import os\nimport subprocess\n\n# The actual version string. For precompiled binaries, this will be changed to include the build\n# tag, e.g. \"3.0.0.dev0042-0xcafeabc\"\nVERSION = \"3.0.0\"\nPATHOD = \"pathod \" + VERSION\nMITMPROXY = \"mitmproxy \" + VERSION\n\n# Serialization format version. This is displayed nowhere, it just needs to be incremented by one\n# for each change in the file format.\nFLOW_FORMAT_VERSION = 5\n\n\ndef get_version(dev: bool = False, build: bool = False, refresh: bool = False) -> str:\n    \"\"\"\n    Return a detailed version string, sourced either from a hardcoded VERSION constant\n    or obtained dynamically using git.\n\n    Args:\n        dev: If True, non-tagged releases will include a \".devXXXX\" suffix, where XXXX is the number\n             of commits since the last tagged release.\n        build: If True, non-tagged releases will include a \"-0xXXXXXXX\" suffix, where XXXXXXX are\n               the first seven digits of the commit hash.\n        refresh: If True, always try to use git instead of a potentially hardcoded constant.\n    \"\"\"\n\n    mitmproxy_version = VERSION\n\n    if \"dev\" in VERSION and not refresh:\n        pass  # There is a hardcoded build tag, so we just use what's there.\n    elif dev or build:\n        here = os.path.abspath(os.path.join(os.path.dirname(__file__), \"..\"))\n        try:\n            git_describe = subprocess.check_output(\n                ['git', 'describe', '--tags', '--long'],\n                stderr=subprocess.STDOUT,\n                cwd=here,\n            )\n            last_tag, tag_dist, commit = git_describe.decode().strip().rsplit(\"-\", 2)\n            commit = commit.lstrip(\"g\")[:7]\n            tag_dist = int(tag_dist)\n        except Exception:\n            pass\n        else:\n            # Remove current suffix\n            mitmproxy_version = mitmproxy_version.split(\".dev\")[0]\n\n            # Add suffix for non-tagged releases\n            if tag_dist > 0:\n                mitmproxy_version += \".dev{tag_dist}\".format(tag_dist=tag_dist)\n                # The wheel build tag (we use the commit) must start with a digit, so we include \"0x\"\n                mitmproxy_version += \"-0x{commit}\".format(commit=commit)\n\n    if not dev:\n        mitmproxy_version = mitmproxy_version.split(\".dev\")[0]\n    elif not build:\n        mitmproxy_version = mitmproxy_version.split(\"-0x\")[0]\n\n    return mitmproxy_version\n\n\nif __name__ == \"__main__\":\n    print(VERSION)\n", "path": "mitmproxy/version.py"}]}