prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  import TurbiniaException to partitions.py
  ```
  Traceback (most recent call last):
    File "PATH/v2/lib/python3.8/site-packages/turbinia/workers/__init__.py", line 916, in run_wrapper
      self.result = self.run(evidence, self.result)
    File "PATH/v2/lib/python3.8/site-packages/turbinia/workers/partitions.py", line 144, in run
      path_specs = partitions.Enumerate(evidence)
    File "/PATH/v2/lib/python3.8/site-packages/turbinia/processors/partitions.py", line 49, in Enumerate
      raise TurbiniaException(
  NameError: name 'TurbiniaException' is not defined
  
  2021-03-05 18:45:56 [ERROR] PartitionEnumerationTask Task failed with exception: [name 'TurbiniaException' is not defined]
  ```
  
  </issue>
  <code>
  [start of turbinia/processors/partitions.py]
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2021 Google LLC
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 # https://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 """Evidence processor to enumerate partitions."""
  16 
  17 import logging
  18 
  19 from dfvfs.helpers import volume_scanner
  20 from dfvfs.lib import definitions as dfvfs_definitions
  21 from dfvfs.lib import errors as dfvfs_errors
  22 
  23 from turbinia.lib.dfvfs_classes import UnattendedVolumeScannerMediator
  24 
  25 log = logging.getLogger('turbinia')
  26 
  27 
  28 def Enumerate(evidence):
  29   """Uses dfVFS to enumerate partitions in a disk / image.
  30 
  31   Args:
  32     evidence: Evidence object to be scanned.
  33 
  34   Raises:
  35     TurbiniaException if source evidence can't be scanned.
  36 
  37   Returns:
  38     list[dfVFS.path_spec]: path specs for identified partitions
  39   """
  40   dfvfs_definitions.PREFERRED_GPT_BACK_END = (
  41       dfvfs_definitions.TYPE_INDICATOR_GPT)
  42   mediator = UnattendedVolumeScannerMediator()
  43   mediator.credentials = evidence.credentials
  44   path_specs = []
  45   try:
  46     scanner = volume_scanner.VolumeScanner(mediator=mediator)
  47     path_specs = scanner.GetBasePathSpecs(evidence.local_path)
  48   except dfvfs_errors.ScannerError as e:
  49     raise TurbiniaException(
  50         'Could not enumerate partitions [{0!s}]: {1!s}'.format(
  51             evidence.local_path, e))
  52 
  53   return path_specs
  54 
  55 
  56 def GetPartitionEncryptionType(path_spec):
  57   """Checks a partition for encryption.
  58 
  59   Args:
  60     path_spec (dfVFS.path_spec): Partition path_spec.
  61 
  62   Returns:
  63     String representing the type of encryption, or None.
  64   """
  65   encryption_type = None
  66   if path_spec.parent.type_indicator == dfvfs_definitions.TYPE_INDICATOR_BDE:
  67     encryption_type = 'BDE'
  68   return encryption_type
  69 
  70 
  71 def GetPathSpecByLocation(path_specs, location):
  72   """Finds a path_spec from a list of path_specs for a given location.
  73 
  74   Args:
  75     path_specs (list[dfVFS.path_spec]): List of path_specs from volume scanner.
  76     location (str): dfVFS location to search for.
  77 
  78   Returns:
  79     dfVFS.path_spec for the given location or None if not found.
  80   """
  81   for path_spec in path_specs:
  82     child_path_spec = path_spec
  83     fs_location = getattr(path_spec, 'location', None)
  84     while path_spec.HasParent():
  85       type_indicator = path_spec.type_indicator
  86       if type_indicator in (dfvfs_definitions.TYPE_INDICATOR_TSK_PARTITION,
  87                             dfvfs_definitions.TYPE_INDICATOR_GPT):
  88         if fs_location in ('\\', '/'):
  89           fs_location = getattr(path_spec, 'location', None)
  90         break
  91       path_spec = path_spec.parent
  92     if fs_location == location:
  93       return child_path_spec
  94   return None
  95
  [end of turbinia/processors/partitions.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/turbinia/processors/partitions.py b/turbinia/processors/partitions.py
  --- a/turbinia/processors/partitions.py
  +++ b/turbinia/processors/partitions.py
  @@ -21,6 +21,7 @@
   from dfvfs.lib import errors as dfvfs_errors
   
   from turbinia.lib.dfvfs_classes import UnattendedVolumeScannerMediator
  +from turbinia import TurbiniaException
   
   log = logging.getLogger('turbinia')
  
verification_info: {"golden_diff": "diff --git a/turbinia/processors/partitions.py b/turbinia/processors/partitions.py\n--- a/turbinia/processors/partitions.py\n+++ b/turbinia/processors/partitions.py\n@@ -21,6 +21,7 @@\n from dfvfs.lib import errors as dfvfs_errors\n \n from turbinia.lib.dfvfs_classes import UnattendedVolumeScannerMediator\n+from turbinia import TurbiniaException\n \n log = logging.getLogger('turbinia')\n", "issue": "import TurbiniaException to partitions.py\n```\r\nTraceback (most recent call last):\r\n  File \"PATH/v2/lib/python3.8/site-packages/turbinia/workers/__init__.py\", line 916, in run_wrapper\r\n    self.result = self.run(evidence, self.result)\r\n  File \"PATH/v2/lib/python3.8/site-packages/turbinia/workers/partitions.py\", line 144, in run\r\n    path_specs = partitions.Enumerate(evidence)\r\n  File \"/PATH/v2/lib/python3.8/site-packages/turbinia/processors/partitions.py\", line 49, in Enumerate\r\n    raise TurbiniaException(\r\nNameError: name 'TurbiniaException' is not defined\r\n\r\n2021-03-05 18:45:56 [ERROR] PartitionEnumerationTask Task failed with exception: [name 'TurbiniaException' is not defined]\r\n```\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2021 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Evidence processor to enumerate partitions.\"\"\"\n\nimport logging\n\nfrom dfvfs.helpers import volume_scanner\nfrom dfvfs.lib import definitions as dfvfs_definitions\nfrom dfvfs.lib import errors as dfvfs_errors\n\nfrom turbinia.lib.dfvfs_classes import UnattendedVolumeScannerMediator\n\nlog = logging.getLogger('turbinia')\n\n\ndef Enumerate(evidence):\n  \"\"\"Uses dfVFS to enumerate partitions in a disk / image.\n\n  Args:\n    evidence: Evidence object to be scanned.\n\n  Raises:\n    TurbiniaException if source evidence can't be scanned.\n\n  Returns:\n    list[dfVFS.path_spec]: path specs for identified partitions\n  \"\"\"\n  dfvfs_definitions.PREFERRED_GPT_BACK_END = (\n      dfvfs_definitions.TYPE_INDICATOR_GPT)\n  mediator = UnattendedVolumeScannerMediator()\n  mediator.credentials = evidence.credentials\n  path_specs = []\n  try:\n    scanner = volume_scanner.VolumeScanner(mediator=mediator)\n    path_specs = scanner.GetBasePathSpecs(evidence.local_path)\n  except dfvfs_errors.ScannerError as e:\n    raise TurbiniaException(\n        'Could not enumerate partitions [{0!s}]: {1!s}'.format(\n            evidence.local_path, e))\n\n  return path_specs\n\n\ndef GetPartitionEncryptionType(path_spec):\n  \"\"\"Checks a partition for encryption.\n\n  Args:\n    path_spec (dfVFS.path_spec): Partition path_spec.\n\n  Returns:\n    String representing the type of encryption, or None.\n  \"\"\"\n  encryption_type = None\n  if path_spec.parent.type_indicator == dfvfs_definitions.TYPE_INDICATOR_BDE:\n    encryption_type = 'BDE'\n  return encryption_type\n\n\ndef GetPathSpecByLocation(path_specs, location):\n  \"\"\"Finds a path_spec from a list of path_specs for a given location.\n\n  Args:\n    path_specs (list[dfVFS.path_spec]): List of path_specs from volume scanner.\n    location (str): dfVFS location to search for.\n\n  Returns:\n    dfVFS.path_spec for the given location or None if not found.\n  \"\"\"\n  for path_spec in path_specs:\n    child_path_spec = path_spec\n    fs_location = getattr(path_spec, 'location', None)\n    while path_spec.HasParent():\n      type_indicator = path_spec.type_indicator\n      if type_indicator in (dfvfs_definitions.TYPE_INDICATOR_TSK_PARTITION,\n                            dfvfs_definitions.TYPE_INDICATOR_GPT):\n        if fs_location in ('\\\\', '/'):\n          fs_location = getattr(path_spec, 'location', None)\n        break\n      path_spec = path_spec.parent\n    if fs_location == location:\n      return child_path_spec\n  return None\n", "path": "turbinia/processors/partitions.py"}]}