prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  NC - Committee assignments missing for a house member
  State: NC
  
  There may be more, I just happen to find this today. Jay Adams is missing committee assignments. The API does not show any in roles. 
  
  https://openstates.org/api/v1/legislators/NCL000338/
  
  The NCGA site shows committee assignments here: http://www.ncleg.net/gascripts/members/reports/committeeAssignments.pl?nUserid=697&Chamber=H
  
  There may be something broken and it may affect more members in NC.
  
  I have assignments for others. Have not determined what is different between Adams and the others
  
  </issue>
  <code>
  [start of openstates/nc/committees.py]
  1 from billy.scrape.committees import CommitteeScraper, Committee
  2 
  3 import lxml.html
  4 
  5 class NCCommitteeScraper(CommitteeScraper):
  6     jurisdiction = 'nc'
  7 
  8     def scrape_committee(self, committee, url):
  9         url = url.replace(' ', '%20') + '&bPrintable=true'
  10         data = self.get(url).text
  11         doc = lxml.html.fromstring(data)
  12         for row in doc.xpath('//table/tr'):
  13             children = row.getchildren()
  14             if len(children) != 2:
  15                 self.log('skipping members for ' + committee['committee'])
  16                 continue
  17             mtype, members = row.getchildren()
  18             if mtype.text == 'Members':
  19                 for m in members.getchildren():
  20                     committee.add_member(m.text)
  21             else:
  22                 committee.add_member(members.text_content(), mtype.text)
  23 
  24 
  25     def scrape(self, term, chambers):
  26         base_url = 'http://www.ncga.state.nc.us/gascripts/Committees/Committees.asp?bPrintable=true&sAction=ViewCommitteeType&sActionDetails='
  27 
  28         chamber_slugs = {'upper': ['Senate%20Standing', 'Senate%20Select'],
  29                          'lower': ['House%20Standing', 'House%20Select']}
  30 
  31         for chamber in chambers:
  32             for ctype in chamber_slugs[chamber]:
  33                 data = self.get(base_url + ctype).text
  34                 doc = lxml.html.fromstring(data)
  35                 doc.make_links_absolute(base_url+ctype)
  36                 for comm in doc.xpath('//ul/li/a'):
  37                     name = comm.text
  38                     # skip committee of whole Senate
  39                     if 'Whole Senate' in name:
  40                         continue
  41                     url = comm.get('href')
  42                     committee = Committee(chamber, name)
  43                     self.scrape_committee(committee, url)
  44                     committee.add_source(url)
  45                     if not committee['members']:
  46                         self.warning('empty committee: %s', name)
  47                     else:
  48                         self.save_committee(committee)
  49 
  50
  [end of openstates/nc/committees.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/openstates/nc/committees.py b/openstates/nc/committees.py
  --- a/openstates/nc/committees.py
  +++ b/openstates/nc/committees.py
  @@ -17,10 +17,23 @@
               mtype, members = row.getchildren()
               if mtype.text == 'Members':
                   for m in members.getchildren():
  -                    committee.add_member(m.text)
  +                    member_name = self._clean_member_name(m.text)
  +                    committee.add_member(member_name)
               else:
  -                committee.add_member(members.text_content(), mtype.text)
  +                member_name = self._clean_member_name(members.text_content())
  +                committee.add_member(member_name, mtype.text)
   
  +    def _clean_member_name(self, name):
  +        """Names are displayed as "Office. LastName", e.g. "Rep. Adamsa". This strips the "Office. "
  +
  +        This helps the NameMatcher in billy link this to the correct legislator.
  +        """
  +        for prefix in ['Rep. ', 'Sen. ']:
  +            if name.startswith(prefix):
  +                return name.replace(prefix, '')
  +
  +        # If none hit, return the name as is
  +        return name
   
       def scrape(self, term, chambers):
           base_url = 'http://www.ncga.state.nc.us/gascripts/Committees/Committees.asp?bPrintable=true&sAction=ViewCommitteeType&sActionDetails='
  
verification_info: {"golden_diff": "diff --git a/openstates/nc/committees.py b/openstates/nc/committees.py\n--- a/openstates/nc/committees.py\n+++ b/openstates/nc/committees.py\n@@ -17,10 +17,23 @@\n             mtype, members = row.getchildren()\n             if mtype.text == 'Members':\n                 for m in members.getchildren():\n-                    committee.add_member(m.text)\n+                    member_name = self._clean_member_name(m.text)\n+                    committee.add_member(member_name)\n             else:\n-                committee.add_member(members.text_content(), mtype.text)\n+                member_name = self._clean_member_name(members.text_content())\n+                committee.add_member(member_name, mtype.text)\n \n+    def _clean_member_name(self, name):\n+        \"\"\"Names are displayed as \"Office. LastName\", e.g. \"Rep. Adamsa\". This strips the \"Office. \"\n+\n+        This helps the NameMatcher in billy link this to the correct legislator.\n+        \"\"\"\n+        for prefix in ['Rep. ', 'Sen. ']:\n+            if name.startswith(prefix):\n+                return name.replace(prefix, '')\n+\n+        # If none hit, return the name as is\n+        return name\n \n     def scrape(self, term, chambers):\n         base_url = 'http://www.ncga.state.nc.us/gascripts/Committees/Committees.asp?bPrintable=true&sAction=ViewCommitteeType&sActionDetails='\n", "issue": "NC - Committee assignments missing for a house member\nState: NC\r\n\r\nThere may be more, I just happen to find this today. Jay Adams is missing committee assignments. The API does not show any in roles. \r\n\r\nhttps://openstates.org/api/v1/legislators/NCL000338/\r\n\r\nThe NCGA site shows committee assignments here: http://www.ncleg.net/gascripts/members/reports/committeeAssignments.pl?nUserid=697&Chamber=H\r\n\r\nThere may be something broken and it may affect more members in NC.\r\n\r\nI have assignments for others. Have not determined what is different between Adams and the others\n", "before_files": [{"content": "from billy.scrape.committees import CommitteeScraper, Committee\n\nimport lxml.html\n\nclass NCCommitteeScraper(CommitteeScraper):\n    jurisdiction = 'nc'\n\n    def scrape_committee(self, committee, url):\n        url = url.replace(' ', '%20') + '&bPrintable=true'\n        data = self.get(url).text\n        doc = lxml.html.fromstring(data)\n        for row in doc.xpath('//table/tr'):\n            children = row.getchildren()\n            if len(children) != 2:\n                self.log('skipping members for ' + committee['committee'])\n                continue\n            mtype, members = row.getchildren()\n            if mtype.text == 'Members':\n                for m in members.getchildren():\n                    committee.add_member(m.text)\n            else:\n                committee.add_member(members.text_content(), mtype.text)\n\n\n    def scrape(self, term, chambers):\n        base_url = 'http://www.ncga.state.nc.us/gascripts/Committees/Committees.asp?bPrintable=true&sAction=ViewCommitteeType&sActionDetails='\n\n        chamber_slugs = {'upper': ['Senate%20Standing', 'Senate%20Select'],\n                         'lower': ['House%20Standing', 'House%20Select']}\n\n        for chamber in chambers:\n            for ctype in chamber_slugs[chamber]:\n                data = self.get(base_url + ctype).text\n                doc = lxml.html.fromstring(data)\n                doc.make_links_absolute(base_url+ctype)\n                for comm in doc.xpath('//ul/li/a'):\n                    name = comm.text\n                    # skip committee of whole Senate\n                    if 'Whole Senate' in name:\n                        continue\n                    url = comm.get('href')\n                    committee = Committee(chamber, name)\n                    self.scrape_committee(committee, url)\n                    committee.add_source(url)\n                    if not committee['members']:\n                        self.warning('empty committee: %s', name)\n                    else:\n                        self.save_committee(committee)\n\n", "path": "openstates/nc/committees.py"}]}