prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  change_hook/poller not working for ReconfigurablePollingChangeSource
  In [poller.py](https://github.com/buildbot/buildbot/blob/a0e1d8840e8856ead136a1ad6e2021931355af15/master/buildbot/www/hooks/poller.py#L40), the change sources are filtered like this:
  
  ```python
          for source in change_svc:
              if not isinstance(source, PollingChangeSource):
                  continue
  ```
  
  This means that any pollers derived from the super-class `ReconfigurablePollingChangeSource` will not be found. Since [new code is supposed to use `ReconfigurablePollingChangeSource`](https://docs.buildbot.net/current/developer/cls-changesources.html?highlight=reconfigurablepollingchangesource#pollingchangesource), the code should probably read:
  
  ```python
          for source in change_svc:
              if not isinstance(source, ReconfigurablePollingChangeSource):
                  continue
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `master/buildbot/www/hooks/poller.py`
  Content:
  ```
  1 # This file is part of Buildbot.  Buildbot is free software: you can
  2 # redistribute it and/or modify it under the terms of the GNU General Public
  3 # License as published by the Free Software Foundation, version 2.
  4 #
  5 # This program is distributed in the hope that it will be useful, but WITHOUT
  6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  7 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  8 # details.
  9 #
  10 # You should have received a copy of the GNU General Public License along with
  11 # this program; if not, write to the Free Software Foundation, Inc., 51
  12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  13 #
  14 # Copyright Buildbot Team Members
  15 
  16 # This change hook allows GitHub or a hand crafted curl invocation to "knock on
  17 # the door" and trigger a change source to poll.
  18 
  19 
  20 from buildbot.changes.base import PollingChangeSource
  21 from buildbot.util import bytes2unicode
  22 from buildbot.util import unicode2bytes
  23 from buildbot.www.hooks.base import BaseHookHandler
  24 
  25 
  26 class PollingHandler(BaseHookHandler):
  27 
  28     def getChanges(self, req):
  29         change_svc = req.site.master.change_svc
  30         poll_all = b"poller" not in req.args
  31 
  32         allow_all = True
  33         allowed = []
  34         if isinstance(self.options, dict) and b"allowed" in self.options:
  35             allow_all = False
  36             allowed = self.options[b"allowed"]
  37 
  38         pollers = []
  39 
  40         for source in change_svc:
  41             if not isinstance(source, PollingChangeSource):
  42                 continue
  43             if not hasattr(source, "name"):
  44                 continue
  45             if (not poll_all and
  46                unicode2bytes(source.name) not in req.args[b'poller']):
  47                 continue
  48             if not allow_all and unicode2bytes(source.name) not in allowed:
  49                 continue
  50             pollers.append(source)
  51 
  52         if not poll_all:
  53             missing = (set(req.args[b'poller']) -
  54                       set(unicode2bytes(s.name) for s in pollers))
  55             if missing:
  56                 raise ValueError("Could not find pollers: {}".format(
  57                     bytes2unicode(b",".join(missing))))
  58 
  59         for p in pollers:
  60             p.force()
  61 
  62         return [], None
  63 
  64 
  65 poller = PollingHandler
  66
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/master/buildbot/www/hooks/poller.py b/master/buildbot/www/hooks/poller.py
  --- a/master/buildbot/www/hooks/poller.py
  +++ b/master/buildbot/www/hooks/poller.py
  @@ -17,7 +17,7 @@
   # the door" and trigger a change source to poll.
   
   
  -from buildbot.changes.base import PollingChangeSource
  +from buildbot.changes.base import ReconfigurablePollingChangeSource
   from buildbot.util import bytes2unicode
   from buildbot.util import unicode2bytes
   from buildbot.www.hooks.base import BaseHookHandler
  @@ -38,7 +38,7 @@
           pollers = []
   
           for source in change_svc:
  -            if not isinstance(source, PollingChangeSource):
  +            if not isinstance(source, ReconfigurablePollingChangeSource):
                   continue
               if not hasattr(source, "name"):
                   continue
  
verification_info: {"golden_diff": "diff --git a/master/buildbot/www/hooks/poller.py b/master/buildbot/www/hooks/poller.py\n--- a/master/buildbot/www/hooks/poller.py\n+++ b/master/buildbot/www/hooks/poller.py\n@@ -17,7 +17,7 @@\n # the door\" and trigger a change source to poll.\n \n \n-from buildbot.changes.base import PollingChangeSource\n+from buildbot.changes.base import ReconfigurablePollingChangeSource\n from buildbot.util import bytes2unicode\n from buildbot.util import unicode2bytes\n from buildbot.www.hooks.base import BaseHookHandler\n@@ -38,7 +38,7 @@\n         pollers = []\n \n         for source in change_svc:\n-            if not isinstance(source, PollingChangeSource):\n+            if not isinstance(source, ReconfigurablePollingChangeSource):\n                 continue\n             if not hasattr(source, \"name\"):\n                 continue\n", "issue": "change_hook/poller not working for ReconfigurablePollingChangeSource\nIn [poller.py](https://github.com/buildbot/buildbot/blob/a0e1d8840e8856ead136a1ad6e2021931355af15/master/buildbot/www/hooks/poller.py#L40), the change sources are filtered like this:\r\n\r\n```python\r\n        for source in change_svc:\r\n            if not isinstance(source, PollingChangeSource):\r\n                continue\r\n```\r\n\r\nThis means that any pollers derived from the super-class `ReconfigurablePollingChangeSource` will not be found. Since [new code is supposed to use `ReconfigurablePollingChangeSource`](https://docs.buildbot.net/current/developer/cls-changesources.html?highlight=reconfigurablepollingchangesource#pollingchangesource), the code should probably read:\r\n\r\n```python\r\n        for source in change_svc:\r\n            if not isinstance(source, ReconfigurablePollingChangeSource):\r\n                continue\r\n```\r\n\n", "before_files": [{"content": "# This file is part of Buildbot.  Buildbot is free software: you can\n# redistribute it and/or modify it under the terms of the GNU General Public\n# License as published by the Free Software Foundation, version 2.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details.\n#\n# You should have received a copy of the GNU General Public License along with\n# this program; if not, write to the Free Software Foundation, Inc., 51\n# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n#\n# Copyright Buildbot Team Members\n\n# This change hook allows GitHub or a hand crafted curl invocation to \"knock on\n# the door\" and trigger a change source to poll.\n\n\nfrom buildbot.changes.base import PollingChangeSource\nfrom buildbot.util import bytes2unicode\nfrom buildbot.util import unicode2bytes\nfrom buildbot.www.hooks.base import BaseHookHandler\n\n\nclass PollingHandler(BaseHookHandler):\n\n    def getChanges(self, req):\n        change_svc = req.site.master.change_svc\n        poll_all = b\"poller\" not in req.args\n\n        allow_all = True\n        allowed = []\n        if isinstance(self.options, dict) and b\"allowed\" in self.options:\n            allow_all = False\n            allowed = self.options[b\"allowed\"]\n\n        pollers = []\n\n        for source in change_svc:\n            if not isinstance(source, PollingChangeSource):\n                continue\n            if not hasattr(source, \"name\"):\n                continue\n            if (not poll_all and\n               unicode2bytes(source.name) not in req.args[b'poller']):\n                continue\n            if not allow_all and unicode2bytes(source.name) not in allowed:\n                continue\n            pollers.append(source)\n\n        if not poll_all:\n            missing = (set(req.args[b'poller']) -\n                      set(unicode2bytes(s.name) for s in pollers))\n            if missing:\n                raise ValueError(\"Could not find pollers: {}\".format(\n                    bytes2unicode(b\",\".join(missing))))\n\n        for p in pollers:\n            p.force()\n\n        return [], None\n\n\npoller = PollingHandler\n", "path": "master/buildbot/www/hooks/poller.py"}], "after_files": [{"content": "# This file is part of Buildbot.  Buildbot is free software: you can\n# redistribute it and/or modify it under the terms of the GNU General Public\n# License as published by the Free Software Foundation, version 2.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details.\n#\n# You should have received a copy of the GNU General Public License along with\n# this program; if not, write to the Free Software Foundation, Inc., 51\n# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n#\n# Copyright Buildbot Team Members\n\n# This change hook allows GitHub or a hand crafted curl invocation to \"knock on\n# the door\" and trigger a change source to poll.\n\n\nfrom buildbot.changes.base import ReconfigurablePollingChangeSource\nfrom buildbot.util import bytes2unicode\nfrom buildbot.util import unicode2bytes\nfrom buildbot.www.hooks.base import BaseHookHandler\n\n\nclass PollingHandler(BaseHookHandler):\n\n    def getChanges(self, req):\n        change_svc = req.site.master.change_svc\n        poll_all = b\"poller\" not in req.args\n\n        allow_all = True\n        allowed = []\n        if isinstance(self.options, dict) and b\"allowed\" in self.options:\n            allow_all = False\n            allowed = self.options[b\"allowed\"]\n\n        pollers = []\n\n        for source in change_svc:\n            if not isinstance(source, ReconfigurablePollingChangeSource):\n                continue\n            if not hasattr(source, \"name\"):\n                continue\n            if (not poll_all and\n               unicode2bytes(source.name) not in req.args[b'poller']):\n                continue\n            if not allow_all and unicode2bytes(source.name) not in allowed:\n                continue\n            pollers.append(source)\n\n        if not poll_all:\n            missing = (set(req.args[b'poller']) -\n                      set(unicode2bytes(s.name) for s in pollers))\n            if missing:\n                raise ValueError(\"Could not find pollers: {}\".format(\n                    bytes2unicode(b\",\".join(missing))))\n\n        for p in pollers:\n            p.force()\n\n        return [], None\n\n\npoller = PollingHandler\n", "path": "master/buildbot/www/hooks/poller.py"}]}