prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Poetry run: ModuleOrPackageNotFound with implicit namespace packages (PEP420)
  <!-- Checked checkbox should look like this: [x] -->
  - [x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.
  - [x] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
  - [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).
  
  - **OS version and name**: Arch Linux 4.18.16
  - **Poetry version**: 0.12.5
  - **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://gist.github.com/Kazy/692963f6a41c64d38f38ac9a3f95619a
  
  ## Issue
  I'm using implicit namespace packages to organize the packages at work, which works well by specifying the `packages` value in the `pyproject.toml` like that:
  ```toml
  packages = [
      { include = "org" }
  ]
  ```
  The file structure is like that:
  ```
  ├── org
  │   └── subpackage
  │       ├── __init__.py
  │       └── command
  │           └── cli.py
  └── pyproject.toml
  ```
  
  The issue is when you try to do `poetry run my-command`, you get:
  ```
  [ModuleOrPackageNotFound]
  No file/folder found for package org-subpackage-command
  ```
  
  I already found how to fix it and will follow with a PR, but I wanted to create the issue in case my fix isn't the right one, and to make organization easier on your side as well.
  
  
  </issue>
  <code>
  [start of poetry/console/commands/run.py]
  1 from .env_command import EnvCommand
  2 
  3 
  4 class RunCommand(EnvCommand):
  5     """
  6     Runs a command in the appropriate environment.
  7 
  8     run
  9         { args* : The command and arguments/options to run. }
  10     """
  11 
  12     def handle(self):
  13         args = self.argument("args")
  14         script = args[0]
  15         scripts = self.poetry.local_config.get("scripts")
  16 
  17         if scripts and script in scripts:
  18             return self.run_script(scripts[script], args)
  19 
  20         return self.env.execute(*args)
  21 
  22     def run_script(self, script, args):
  23         if isinstance(script, dict):
  24             script = script["callable"]
  25 
  26         module, callable_ = script.split(":")
  27 
  28         src_in_sys_path = "sys.path.append('src'); " if self._module.is_in_src() else ""
  29 
  30         cmd = ["python", "-c"]
  31 
  32         cmd += [
  33             '"import sys; '
  34             "from importlib import import_module; "
  35             "sys.argv = {!r}; {}"
  36             "import_module('{}').{}()\"".format(
  37                 args, src_in_sys_path, module, callable_
  38             )
  39         ]
  40 
  41         return self.env.run(*cmd, shell=True, call=True)
  42 
  43     @property
  44     def _module(self):
  45         from ...masonry.utils.module import Module
  46 
  47         poetry = self.poetry
  48         package = poetry.package
  49         path = poetry.file.parent
  50         module = Module(package.name, path.as_posix())
  51         return module
  52 
  53     def merge_application_definition(self, merge_args=True):
  54         if self._application is None or (
  55             self._application_definition_merged
  56             and (self._application_definition_merged_with_args or not merge_args)
  57         ):
  58             return
  59 
  60         if merge_args:
  61             current_arguments = self._definition.get_arguments()
  62             self._definition.set_arguments(
  63                 self._application.get_definition().get_arguments()
  64             )
  65             self._definition.add_arguments(current_arguments)
  66 
  67         self._application_definition_merged = True
  68         if merge_args:
  69             self._application_definition_merged_with_args = True
  70
  [end of poetry/console/commands/run.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/poetry/console/commands/run.py b/poetry/console/commands/run.py
  --- a/poetry/console/commands/run.py
  +++ b/poetry/console/commands/run.py
  @@ -47,7 +47,7 @@
           poetry = self.poetry
           package = poetry.package
           path = poetry.file.parent
  -        module = Module(package.name, path.as_posix())
  +        module = Module(package.name, path.as_posix(), package.packages)
           return module
   
       def merge_application_definition(self, merge_args=True):
  
verification_info: {"golden_diff": "diff --git a/poetry/console/commands/run.py b/poetry/console/commands/run.py\n--- a/poetry/console/commands/run.py\n+++ b/poetry/console/commands/run.py\n@@ -47,7 +47,7 @@\n         poetry = self.poetry\n         package = poetry.package\n         path = poetry.file.parent\n-        module = Module(package.name, path.as_posix())\n+        module = Module(package.name, path.as_posix(), package.packages)\n         return module\n \n     def merge_application_definition(self, merge_args=True):\n", "issue": "Poetry run: ModuleOrPackageNotFound with implicit namespace packages (PEP420)\n<!-- Checked checkbox should look like this: [x] -->\r\n- [x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.\r\n- [x] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.\r\n- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).\r\n\r\n- **OS version and name**: Arch Linux 4.18.16\r\n- **Poetry version**: 0.12.5\r\n- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://gist.github.com/Kazy/692963f6a41c64d38f38ac9a3f95619a\r\n\r\n## Issue\r\nI'm using implicit namespace packages to organize the packages at work, which works well by specifying the `packages` value in the `pyproject.toml` like that:\r\n```toml\r\npackages = [\r\n    { include = \"org\" }\r\n]\r\n```\r\nThe file structure is like that:\r\n```\r\n\u251c\u2500\u2500 org\r\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 subpackage\r\n\u2502\u00a0\u00a0     \u251c\u2500\u2500 __init__.py\r\n\u2502\u00a0\u00a0     \u2514\u2500\u2500 command\r\n\u2502\u00a0\u00a0         \u2514\u2500\u2500 cli.py\r\n\u2514\u2500\u2500 pyproject.toml\r\n```\r\n\r\nThe issue is when you try to do `poetry run my-command`, you get:\r\n```\r\n[ModuleOrPackageNotFound]\r\nNo file/folder found for package org-subpackage-command\r\n```\r\n\r\nI already found how to fix it and will follow with a PR, but I wanted to create the issue in case my fix isn't the right one, and to make organization easier on your side as well.\r\n\n", "before_files": [{"content": "from .env_command import EnvCommand\n\n\nclass RunCommand(EnvCommand):\n    \"\"\"\n    Runs a command in the appropriate environment.\n\n    run\n        { args* : The command and arguments/options to run. }\n    \"\"\"\n\n    def handle(self):\n        args = self.argument(\"args\")\n        script = args[0]\n        scripts = self.poetry.local_config.get(\"scripts\")\n\n        if scripts and script in scripts:\n            return self.run_script(scripts[script], args)\n\n        return self.env.execute(*args)\n\n    def run_script(self, script, args):\n        if isinstance(script, dict):\n            script = script[\"callable\"]\n\n        module, callable_ = script.split(\":\")\n\n        src_in_sys_path = \"sys.path.append('src'); \" if self._module.is_in_src() else \"\"\n\n        cmd = [\"python\", \"-c\"]\n\n        cmd += [\n            '\"import sys; '\n            \"from importlib import import_module; \"\n            \"sys.argv = {!r}; {}\"\n            \"import_module('{}').{}()\\\"\".format(\n                args, src_in_sys_path, module, callable_\n            )\n        ]\n\n        return self.env.run(*cmd, shell=True, call=True)\n\n    @property\n    def _module(self):\n        from ...masonry.utils.module import Module\n\n        poetry = self.poetry\n        package = poetry.package\n        path = poetry.file.parent\n        module = Module(package.name, path.as_posix())\n        return module\n\n    def merge_application_definition(self, merge_args=True):\n        if self._application is None or (\n            self._application_definition_merged\n            and (self._application_definition_merged_with_args or not merge_args)\n        ):\n            return\n\n        if merge_args:\n            current_arguments = self._definition.get_arguments()\n            self._definition.set_arguments(\n                self._application.get_definition().get_arguments()\n            )\n            self._definition.add_arguments(current_arguments)\n\n        self._application_definition_merged = True\n        if merge_args:\n            self._application_definition_merged_with_args = True\n", "path": "poetry/console/commands/run.py"}]}