dyyyyyyyy/swe-rebench-filtered-1150 huggingface dataset:
task: metadata: install: pip install -e .[dev]
patch: diff --git a/bugbear.py b/bugbear.py
index 77b4dc6..9249550 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -639,7 +639,6 @@ class BugBearVisitor(ast.NodeVisitor):
             if isinstance(
                 subnode.value,
                 (
-                    ast.Str,
                     ast.Num,
                     ast.Bytes,
                     ast.NameConstant,

problem_statement: B018 wrongly detects inline variable or attribute docstrings
Having an inline attribute doc string or a module variable docstring, it is wrongly marked as B018 (sample from sphinx doc):

```
module_level_variable2 = 98765
"""int: Module level variable documented inline.

The docstring may span multiple lines. The type may optionally be specified
on the first line, separated by a colon.
"""

```
repo: PyCQA/flake8-bugbear
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/b018_classes.py b/tests/b018_classes.py
index 12195c0..551b14e 100644
--- a/tests/b018_classes.py
+++ b/tests/b018_classes.py
@@ -1,6 +1,6 @@
 """
 Should emit:
-B018 - on lines 15-26, 30, 32
+B018 - on lines 16-26, 30, 33
 """
 
 
@@ -30,3 +30,4 @@ class Foo3:
     123
     a = 2
     "str"
+    1
diff --git a/tests/b018_functions.py b/tests/b018_functions.py
index 9764274..f8c3f77 100644
--- a/tests/b018_functions.py
+++ b/tests/b018_functions.py
@@ -1,6 +1,6 @@
 """
 Should emit:
-B018 - on lines 14-25, 29, 31
+B018 - on lines 15-25, 29, 32
 """
 
 
@@ -29,3 +29,4 @@ def foo3():
     123
     a = 2
     "str"
+    3
diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py
index c05b828..319a508 100644
--- a/tests/test_bugbear.py
+++ b/tests/test_bugbear.py
@@ -234,9 +234,9 @@ class BugbearTestCase(unittest.TestCase):
         bbc = BugBearChecker(filename=str(filename))
         errors = list(bbc.run())
 
-        expected = [B018(line, 4) for line in range(14, 26)]
+        expected = [B018(line, 4) for line in range(15, 26)]
         expected.append(B018(29, 4))
-        expected.append(B018(31, 4))
+        expected.append(B018(32, 4))
         self.assertEqual(errors, self.errors(*expected))
 
     def test_b018_classes(self):
@@ -244,9 +244,9 @@ class BugbearTestCase(unittest.TestCase):
         bbc = BugBearChecker(filename=str(filename))
         errors = list(bbc.run())
 
-        expected = [B018(line, 4) for line in range(15, 27)]
+        expected = [B018(line, 4) for line in range(16, 27)]
         expected.append(B018(30, 4))
-        expected.append(B018(32, 4))
+        expected.append(B018(33, 4))
         self.assertEqual(errors, self.errors(*expected))
 
     def test_b901(self):
task: metadata: install: pip install -e .[dev]
patch: diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index ae15621..56fc3ca 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -2265,7 +2265,6 @@ class Checker:
             self.scope[node.name] = prev_definition
 
     def ANNASSIGN(self, node):
-        self.handleNode(node.target, node)
         self.handleAnnotation(node.annotation, node)
         # If the assignment has value, handle the *value* now.
         if node.value:
@@ -2274,6 +2273,7 @@ class Checker:
                 self.handleAnnotation(node.value, node)
             else:
                 self.handleNode(node.value, node)
+        self.handleNode(node.target, node)
 
     def COMPARE(self, node):
         left = node.left

problem_statement: annotated variable hides "undefined name"
this works:

```console
$ pyflakes /dev/stdin <<< 'x = x'
/dev/stdin:1:5: undefined name 'x'
$
```

this does not:

```console
$ pyflakes /dev/stdin <<< 'x: int = x'
$
```
repo: PyCQA/pyflakes
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index 3775cd3..d881205 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -298,6 +298,11 @@ class TestTypeAnnotations(TestCase):
         a: 'a: "A"'
         ''', m.ForwardAnnotationSyntaxError)
 
+    def test_variable_annotation_references_self_name_undefined(self):
+        self.flakes("""
+        x: int = x
+        """, m.UndefinedName)
+
     def test_TypeAlias_annotations(self):
         self.flakes("""
         from typing_extensions import TypeAlias
task: metadata: install: pip install -e .[dev]
patch: diff --git a/src/raspa_ase/calculator.py b/src/raspa_ase/calculator.py
index f1ca04a..1cffc30 100644
--- a/src/raspa_ase/calculator.py
+++ b/src/raspa_ase/calculator.py
@@ -32,27 +32,26 @@ class RaspaProfile(BaseProfile):
     RASPA profile, which defines the command that will be executed and where.
     """
 
-    def __init__(self, binary: Path | str | None = None, **kwargs) -> None:
+    def __init__(self, command: Path | str | None = None, **kwargs) -> None:
         """
         Initialize the RASPA profile. $RASPA_DIR must be set in the environment.
 
         Parameters
         ----------
-        binary
-            The binary to run RASPA. This defaults to doing `${RASPA_DIR}/bin/simulate`
+        command
+            The command to run RASPA. This defaults to doing `${RASPA_DIR}/bin/simulate`
             and typically does not need to be changed.
 
         Returns
         -------
         None
         """
-        super().__init__(**kwargs)
-        if not binary:
+        if not command:
             raspa_dir = os.environ.get("RASPA_DIR")
             if not raspa_dir:
                 raise OSError("RASPA_DIR environment variable not set")
-            binary = f"{raspa_dir}/bin/simulate"
-        self.binary = binary
+            command = f"{raspa_dir}/bin/simulate"
+        super().__init__(command, **kwargs)
 
     def get_calculator_command(self, inputfile: str = SIMULATION_INPUT) -> list[str]:
         """
@@ -68,7 +67,7 @@ class RaspaProfile(BaseProfile):
         list[str]
             The command to run the calculator.
         """
-        return [self.binary, f"{inputfile}"]
+        return [self.command, f"{inputfile}"]
 
     def version(self) -> str:
         """

problem_statement: Calculator not working with ASE 3.23
Calculator broke with the refactoring in ASE 3.23 :( needs a patch as shown in the tests
repo: Quantum-Accelerators/raspa_ase
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_calculator.py b/tests/test_calculator.py
index 6b2703b..17a5db5 100644
--- a/tests/test_calculator.py
+++ b/tests/test_calculator.py
@@ -19,7 +19,7 @@ def test_profile_bad(monkeypatch):
 
 def test_profile():
     profile = RaspaProfile()
-    assert profile.binary == f"{os.getenv('RASPA_DIR')}/bin/simulate"
+    assert profile.command == f"{os.getenv('RASPA_DIR')}/bin/simulate"
 
     assert profile.get_calculator_command() == [
         f"{os.getenv('RASPA_DIR')}/bin/simulate",
@@ -31,8 +31,8 @@ def test_profile():
 
 
 def test_profil2e():
-    profile = RaspaProfile(binary="my/path")
-    assert profile.binary == "my/path"
+    profile = RaspaProfile(command="my/path")
+    assert profile.command == "my/path"
 
     assert profile.get_calculator_command() == [
         "my/path",
task: metadata: install: pip install -e .
patch: diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..3ae5eb0
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,7 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+This project adheres to [Semantic Versioning](http://semver.org/).
+
+## [UNRELEASED] - 0000-00-00
+### Added
+- Support callback_url in API requests (#10)
\ No newline at end of file
diff --git a/quickpay_api_client/api.py b/quickpay_api_client/api.py
index 72ef0f1..0295f02 100644
--- a/quickpay_api_client/api.py
+++ b/quickpay_api_client/api.py
@@ -50,6 +50,10 @@ class QPApi(object):
             "User-Agent": "quickpay-python-client, v%s" % quickpay_api_client.__version__
         }
 
+        callback_url = kwargs.pop("callback_url", None)
+        if callback_url:
+            headers["Quickpay-Callback-Url"] = callback_url
+
         if self.secret:
             headers["Authorization"
                     ] = "Basic {0}".format(_base64_encode(self.secret))

problem_statement: QuickPay-Callback-Url
It is not possible to change the header QuickPay-Callback-Url using this client.

This would be useful when it is not accepted in the body, e.g. 
[POST /subscriptions/{id}/recurring](https://learn.quickpay.net/tech-talk/api/services/#POST-subscriptions--id-recurring---format-)
repo: QuickPay/quickpay-python-client
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/quickpay_api_client/tests/api_tests.py b/quickpay_api_client/tests/api_tests.py
index 8133e8f..066235b 100644
--- a/quickpay_api_client/tests/api_tests.py
+++ b/quickpay_api_client/tests/api_tests.py
@@ -43,6 +43,15 @@ class TestApi(object):
         assert_equal(req_headers['Accept-Version'], 'v10')
         assert req_headers['User-Agent']
 
+    @responses.activate
+    def test_callback_url_headers(self):
+        self.setup_request()
+        callback_url = "https://foo.bar"
+        res = self.api.perform("get", "/test", callback_url=callback_url)
+
+        req_headers = responses.calls[0].request.headers
+        assert_equal(req_headers['Quickpay-Callback-Url'], callback_url)
+
     @responses.activate
     def test_perform_when_raw(self):
         self.setup_request()
task: metadata: install: pip install -e .[devel]
patch: diff --git a/reproman/support/jobs/orchestrators.py b/reproman/support/jobs/orchestrators.py
index 8191a70..2ec5a8a 100644
--- a/reproman/support/jobs/orchestrators.py
+++ b/reproman/support/jobs/orchestrators.py
@@ -890,19 +890,18 @@ class FetchPlainMixin(object):
                 # treat it as the file.
                 op.join(self.local_directory, ""))
 
-        def get_failed_meta(mdir, failed):
-            for idx in failed:
-                for f in ["status", "stdout", "stderr"]:
-                    self.session.get(
-                        op.join(self.meta_directory,
-                                "{}.{:d}".format(f, idx)),
-                        op.join(self.local_directory,
-                                op.relpath(self.meta_directory,
-                                           self.working_directory),
-                                ""))
+        for idx in range(len(self.job_spec["_command_array"])):
+            for f in ["status", "stdout", "stderr"]:
+                self.session.get(
+                    op.join(self.meta_directory,
+                            "{}.{:d}".format(f, idx)),
+                    op.join(self.local_directory,
+                            op.relpath(self.meta_directory,
+                                       self.working_directory),
+                            ""))
 
         failed = self.get_failed_subjobs()
-        self.log_failed(failed, func=get_failed_meta)
+        self.log_failed(failed)
 
         lgr.info("Outputs fetched. Finished with remote resource '%s'",
                  self.resource.name)

problem_statement: plain orchestrator: make sure that it at least fetches logs (stdout/err) even if not --output's were specified?
repo: ReproNim/reproman
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/reproman/support/jobs/tests/test_orchestrators.py b/reproman/support/jobs/tests/test_orchestrators.py
index 290422b..925db6d 100644
--- a/reproman/support/jobs/tests/test_orchestrators.py
+++ b/reproman/support/jobs/tests/test_orchestrators.py
@@ -104,6 +104,11 @@ def check_orc_plain(tmpdir):
 
             orc.fetch()
             assert open("out").read() == "content\nmore\n"
+
+            metadir_local = op.relpath(orc.meta_directory,
+                                       orc.working_directory)
+            for fname in "status", "stderr", "stdout":
+                assert op.exists(op.join(metadir_local, fname + ".0"))
     return fn
task: metadata: install: pip install -e .
patch: diff --git a/CHANGELOG.md b/CHANGELOG.md
index 51fd6d2..675a8c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@
 ### Added
 
  * `identity` command for calculating pairwise identity between arbitrary
-   queries and references ([#31])
+   queries and references ([#31], [#37])
  * Support for showing basic tree topology for Newick-format files in `show`
    command ([#33])
 
@@ -15,6 +15,7 @@
  * broken pipes (such as from `igseq something | something else`) are now
    handled gracefully ([#30])
 
+[#37]: https://github.com/ShawHahnLab/igseq/pull/37
 [#35]: https://github.com/ShawHahnLab/igseq/pull/35
 [#33]: https://github.com/ShawHahnLab/igseq/pull/33
 [#31]: https://github.com/ShawHahnLab/igseq/pull/31
diff --git a/igseq/identity.py b/igseq/identity.py
index e942641..ed23394 100644
--- a/igseq/identity.py
+++ b/igseq/identity.py
@@ -10,7 +10,8 @@ allows, for example, junction sequences from an AIRR tsv as queries and a FASTA
 of known junctions as references.
 
 The scoring is based on a simple global pairwise alignment, with matches scored
-as 1, mismatches and gaps 0.
+as 1, mismatches and gaps 0.  Any existing gaps are removed before comparing
+sequences, and differeces in case (lower/upper) are disregarded.
 """
 
 import logging
@@ -68,5 +69,12 @@ def score_identity(seq1, seq2):
     """
     # These can be strings or Seq objects, but not SeqRecords.
     if seq1 and seq2:
+        # We'll disregard gaps and case.  If whatever these objects are can't
+        # handle those methods we'll throw a ValueError.
+        try:
+            seq1 = seq1.replace("-", "").upper()
+            seq2 = seq2.replace("-", "").upper()
+        except AttributeError as err:
+            raise ValueError("score_identity arguments should be Seq objects or strings") from err
         return ALIGNER.score(seq1, seq2)/max(len(seq1), len(seq2))
     return 0

problem_statement: Identity calculation should disregard gaps and uppercase/lowercase
In using the new `identity` command I realized it should ignore gaps and uppercase/lowercase differences when comparing sequences.
repo: ShawHahnLab/igseq
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/test_igseq/test_identity.py b/test_igseq/test_identity.py
index 47738b0..9c4226e 100644
--- a/test_igseq/test_identity.py
+++ b/test_igseq/test_identity.py
@@ -138,6 +138,8 @@ class TestScoreIdentity(unittest.TestCase):
         # without also needing a lot of extra metadata tracking.)
         cases = [
             ("ACTG", "ACTG", 1.00), # identical
+            ("AC-G", "A-CG", 1.00), # identical (gaps disregarded)
+            ("ACTG", "actg", 1.00), # identical (case disregarded)
             ("ACTG",     "", 0.00), # one blank -> 0 by definition
             (    "", "ACTG", 0.00), # other blank -> 0 by definition
             (    "",     "", 0.00), # both blank -> 0 by definition
task: metadata: install: pip install -e .[dev]
patch: diff --git a/shopify/resources/event.py b/shopify/resources/event.py
index 5d266d0..0fc1e6f 100644
--- a/shopify/resources/event.py
+++ b/shopify/resources/event.py
@@ -7,6 +7,6 @@ class Event(ShopifyResource):
     def _prefix(cls, options={}):
         resource = options.get("resource")
         if resource:
-            return "%s/s/%s" % (cls.site, resource, options["resource_id"])
+            return "%s/%s/%s" % (cls.site, resource, options["resource_id"])
         else:
             return cls.site

problem_statement: TypeError: not all arguments converted during string formatting in /resources/events.py
Getting the following error trying query order events
```
>>> import shopify
>>> shopify.Order.find(2098647662664).events()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/shopify/mixins.py", line 36, in events
    return shopify.resources.Event.find(resource=self.__class__.plural, resource_id=self.id)
  File "/usr/local/lib/python3.6/site-packages/pyactiveresource/activeresource.py", line 385, in find
    return cls._find_every(from_=from_, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyactiveresource/activeresource.py", line 522, in _find_every
    path = cls._collection_path(prefix_options, query_options)
  File "/usr/local/lib/python3.6/site-packages/pyactiveresource/activeresource.py", line 613, in _collection_path
    'prefix': cls._prefix(prefix_options),
  File "/usr/local/lib/python3.6/site-packages/shopify/resources/event.py", line 10, in _prefix
    return "%s/s/%s" % (cls.site, resource, options["resource_id"])
TypeError: not all arguments converted during string formatting
```
there appears to a missing percent sign for the string formatter:
https://github.com/Shopify/shopify_python_api/blob/master/shopify/resources/event.py#L10
repo: Shopify/shopify_python_api
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/test/event_test.py b/test/event_test.py
new file mode 100644
index 0000000..67e8033
--- /dev/null
+++ b/test/event_test.py
@@ -0,0 +1,12 @@
+import shopify
+from test.test_helper import TestCase
+
+class EventTest(TestCase):
+    def test_prefix_uses_resource(self):
+        prefix = shopify.Event._prefix(options={'resource': "orders", "resource_id": 42})
+        self.assertEqual("https://this-is-my-test-show.myshopify.com/admin/api/unstable/orders/42", prefix)
+
+    def test_prefix_doesnt_need_resource(self):
+        prefix = shopify.Event._prefix()
+        self.assertEqual("https://this-is-my-test-show.myshopify.com/admin/api/unstable", prefix)
+
task: metadata: install: pip install -e .[dev]
patch: diff --git a/src/quom/quom.py b/src/quom/quom.py
index 5dbaad9..5f7d51c 100644
--- a/src/quom/quom.py
+++ b/src/quom/quom.py
@@ -80,6 +80,7 @@ class Quom:
                 raise QuomError('Include not found: "{}"'.format(include_path))
 
         # Skip already processed files.
+        file_path = file_path.resolve()
         if file_path in self.__processed_files:
             return
         self.__processed_files.add(file_path)

problem_statement: option to skip already included files
Hello and thanks for creating such awesome utility! I'm using it in my [CTRE](https://github.com/hanickadot/compile-time-regular-expressions) project. I noticed sometimes quom include same file multiple times. 

Would be possible to add an option to ignore already included files? Based on normalised URL preferably. 

Thanks! ❤️
repo: Viatorus/quom
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_quom/same_file_different_include.py b/tests/test_quom/same_file_different_include.py
new file mode 100644
index 0000000..8ef3b9d
--- /dev/null
+++ b/tests/test_quom/same_file_different_include.py
@@ -0,0 +1,41 @@
+import os
+from io import StringIO
+
+from quom import Quom
+
+FILE_FOO_HPP = """
+#include "../b/bar.hpp"
+"""
+
+FILE_BAR_HPP = """
+int foo();
+"""
+
+FILE_MAIN_CPP = """
+#include "a/foo.hpp"
+#include "b/bar.hpp"
+"""
+
+RESULT = """
+
+int foo();
+"""
+
+
+def test_same_file_different_include(fs):
+    os.makedirs('a')
+    os.makedirs('b')
+
+    with open('main.cpp', 'w+') as file:
+        file.write(FILE_MAIN_CPP)
+
+    with open('a/foo.hpp', 'w+') as file:
+        file.write(FILE_FOO_HPP)
+
+    with open('b/bar.hpp', 'w+') as file:
+        file.write(FILE_BAR_HPP)
+
+    dst = StringIO()
+    Quom('main.cpp', dst)
+
+    assert dst.getvalue() == RESULT
task: metadata: install: pip install -e .
patch: diff --git a/gym_solo/core/obs.py b/gym_solo/core/obs.py
index 8a05a49..2631d4c 100644
--- a/gym_solo/core/obs.py
+++ b/gym_solo/core/obs.py
@@ -202,7 +202,6 @@ class TorsoIMU(Observation):
 
     if self._degrees:
       orien = np.degrees(orien)
-    else:
-      v_ang = np.radians(v_ang)
+      v_ang = np.degrees(v_ang)
 
     return np.concatenate([orien, v_lin, v_ang])

problem_statement: Potential Issue with Consistent Angular Units
https://github.com/WPI-MMR/gym_solo/blob/e4bcb11fb1b18da997494d56acf95bdd512a076a/gym_solo/core/obs.py#L205-L206. 

it doesn't really make sense that they would report one value in radians and one in degrees??
repo: WPI-MMR/gym_solo
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/gym_solo/core/test_obs_observations.py b/gym_solo/core/test_obs_observations.py
index d7774f5..6129894 100644
--- a/gym_solo/core/test_obs_observations.py
+++ b/gym_solo/core/test_obs_observations.py
@@ -56,14 +56,15 @@ class TestTorsoIMU(unittest.TestCase):
       np.testing.assert_allclose(o.compute(),
                                  [0, 0, 90,
                                   30, 60, 90,
-                                  30, 60, 90])
+                                  30 * 180 / np.pi, 
+                                    60 * 180 / np.pi, 90* 180 / np.pi])
     
     with self.subTest('radians'):
       o = obs.TorsoIMU(0, degrees=False)
       np.testing.assert_allclose(o.compute(),
                                  [0, 0, 1/2 * np.pi,
                                   30, 60, 90,
-                                  1/6 * np.pi, 1/3 * np.pi, 1/2 * np.pi])
+                                  30, 60, 90])
 
 
 if __name__ == '__main__':
task: metadata: install: pip install -e .[redis,memcached,msgpack,dev]
patch: diff --git a/aiocache/factory.py b/aiocache/factory.py
index 9ad2f98..ec674fd 100644
--- a/aiocache/factory.py
+++ b/aiocache/factory.py
@@ -60,7 +60,7 @@ class Cache:
     MEMCACHED = AIOCACHE_CACHES.get("memcached")
 
     def __new__(cls, cache_class=MEMORY, **kwargs):
-        if not issubclass(cache_class, BaseCache):
+        if not (cache_class and issubclass(cache_class, BaseCache)):
             raise InvalidCacheType(
                 "Invalid cache type, you can only use {}".format(list(AIOCACHE_CACHES.keys()))
             )

problem_statement: Cache.REDIS: issubclass() arg 1 must be a class
In trying https://stackoverflow.com/questions/65686318/sharing-python-objects-across-multiple-workers I've encountered this exception.

Seems hit same issue here: https://github.com/samuelcolvin/pydantic/issues/545#issuecomment-595983173

From docker stderr:
```
app_1    |   File "/app/./main.py", line 8, in <module>
app_1    |     cache = Cache(Cache.REDIS, endpoint="localhost", port=6379, namespace="main")
app_1    |   File "/usr/local/lib/python3.8/site-packages/aiocache/factory.py", line 65, in __new__
app_1    |     assert issubclass(cache_class, BaseCache)
app_1    | TypeError: issubclass() arg 1 must be a class
```

REPL:

```
>>> from aiocache import Cache
ujson module not found, using json
msgpack not installed, MsgPackSerializer unavailable
>>> Cache()
<aiocache.backends.memory.SimpleMemoryCache object at 0x1085fd820>
>>> Cache(Cache.REDIS)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/variant23/repos/mintad-validator/venv/lib/python3.8/site-packages/aiocache/factory.py", line 65, in __new__
    assert issubclass(cache_class, BaseCache)
TypeError: issubclass() arg 1 must be a class
>>> type(Cache.REDIS)
<class 'NoneType'>
>>> print(Cache.REDIS)
None
>>> print(Cache.MEMORY)
<class 'aiocache.backends.memory.SimpleMemoryCache'>
```

Packages:

```
aiocache==0.11.1
fastapi==0.65.1
pydantic==1.8.2
```


repo: aio-libs/aiocache
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/ut/test_factory.py b/tests/ut/test_factory.py
index 56de47e..54120e9 100644
--- a/tests/ut/test_factory.py
+++ b/tests/ut/test_factory.py
@@ -74,9 +74,10 @@ class TestCache:
     def test_new_defaults_to_memory(self):
         assert isinstance(Cache(), Cache.MEMORY)
 
-    def test_new_invalid_cache_raises(self):
+    @pytest.mark.parametrize("cache_type", (None, object))
+    def test_new_invalid_cache_raises(self, cache_type):
         with pytest.raises(InvalidCacheType) as e:
-            Cache(object)
+            Cache(cache_type)
         assert str(e.value) == "Invalid cache type, you can only use {}".format(
             list(AIOCACHE_CACHES.keys())
         )
task: metadata: install: pip install -e .[dev]
patch: diff --git a/aioftp/client.py b/aioftp/client.py
index a1072b6..566a397 100644
--- a/aioftp/client.py
+++ b/aioftp/client.py
@@ -360,7 +360,7 @@ class BaseClient:
     def parse_ls_date(cls, s, *, now=None):
         """
         Parsing dates from the ls unix utility. For example,
-        "Nov 18  1958" and "Nov 18 12:29".
+        "Nov 18  1958", "Jan 03 2018", and "Nov 18 12:29".
 
         :param s: ls date
         :type s: :py:class:`str`
@@ -439,7 +439,7 @@ class BaseClient:
             raise ValueError
 
         s = s[i:].lstrip()
-        info["modify"] = self.parse_ls_date(s[:12])
+        info["modify"] = self.parse_ls_date(s[:12].strip())
         s = s[12:].strip()
         if info["type"] == "link":
             i = s.rindex(" -> ")
diff --git a/history.rst b/history.rst
index 20ea7de..a78574f 100644
--- a/history.rst
+++ b/history.rst
@@ -1,6 +1,9 @@
 x.x.x (xx-xx-xxxx)
 ------------------
 
+- client: strip date before parsing (#113)
+Thanks to `ndhansen <https://github.com/ndhansen>`_
+
 0.16.0 (11-03-2020)
 ------------------
 

problem_statement: `parse_ls_date` doesn't handle singe-spaced servers.
I'm using aioftp across a multitude of FTP servers, and just discovered that one of them uses a timestamp of `%b %d %Y` instead of `%b %d  %Y`.
Because the parser assumes the date is exactly 12 characters long, it will catch `Jan 03 2018` as `Jan 03 2018 `. This in turn leads to a datetime parsing error.
repo: aio-libs/aioftp
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_simple_functions.py b/tests/test_simple_functions.py
index cada55a..e46448b 100644
--- a/tests/test_simple_functions.py
+++ b/tests/test_simple_functions.py
@@ -165,6 +165,8 @@ def test_parse_list_line_unix():
         ],
         "dir": [
             "drw-rw-r--  1 poh  poh   6595 Feb 27 04:14 history.rst",
+            "drw-rw-r--  1 poh  poh   6595 Jan 03 2016  changes.rst",
+            "drw-rw-r--  1 poh  poh   6595 Mar 10  1996 README.rst",
         ],
         "unknown": [
             "Erw-rw-r--  1 poh  poh   6595 Feb 27 04:14 history.rst",
task: metadata: install: pip install -e .[dev,test,docs,fast,redis,proxy,i18n]
patch: diff --git a/CHANGES/1242.bugfix.rst b/CHANGES/1242.bugfix.rst
new file mode 100644
index 00000000..eb981383
--- /dev/null
+++ b/CHANGES/1242.bugfix.rst
@@ -0,0 +1,1 @@
+Fixed polling startup when "bot" key is passed manually into dispatcher workflow data
diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py
index eb2d55f2..f85c91d4 100644
--- a/aiogram/dispatcher/dispatcher.py
+++ b/aiogram/dispatcher/dispatcher.py
@@ -516,6 +516,9 @@ class Dispatcher(Router):
                 **self.workflow_data,
                 **kwargs,
             }
+            if "bot" in workflow_data:
+                workflow_data.pop("bot")
+
             await self.emit_startup(bot=bots[-1], **workflow_data)
             loggers.dispatcher.info("Start polling")
             try:

problem_statement: TypeError: aiogram.dispatcher.router.Router.emit_startup() got multiple values for keyword argument 'bot'
## Expected Behavior

Successful startup of Dispatcher.start_polling

## Current Behavior

`TypeError: aiogram.dispatcher.router.Router.emit_startup() got multiple values for keyword argument 'bot'`

### Steps to Reproduce

Please provide detailed steps for reproducing the issue.

1. `dispatcher.start_polling(bot)`

### Failure Logs

```
Traceback (most recent call last):
  File "...lib\site-packages\aiogram\dispatcher\dispatcher.py", line 519, in start_polling
    await self.emit_startup(bot=bots[-1], **workflow_data)
TypeError: aiogram.dispatcher.router.Router.emit_startup() got multiple values for keyword argument 'bot'
```
repo: aiogram/aiogram
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_dispatcher/test_dispatcher.py b/tests/test_dispatcher/test_dispatcher.py
index 69aece69..b0cc5b79 100644
--- a/tests/test_dispatcher/test_dispatcher.py
+++ b/tests/test_dispatcher/test_dispatcher.py
@@ -675,6 +675,7 @@ class TestDispatcher:
 
     async def test_start_polling(self, bot: MockedBot):
         dispatcher = Dispatcher()
+        dispatcher.workflow_data["bot"] = 42
         with pytest.raises(
             ValueError, match="At least one bot instance is required to start polling"
         ):
@@ -708,6 +709,8 @@ class TestDispatcher:
             mocked_emit_startup.assert_awaited()
             mocked_process_update.assert_awaited()
             mocked_emit_shutdown.assert_awaited()
+            assert dispatcher.workflow_data["bot"] == 42
+            assert mocked_emit_shutdown.call_args.kwargs["bot"] == bot
 
     async def test_stop_polling(self):
         dispatcher = Dispatcher()
task: metadata: install: pip install -e .
patch: diff --git a/docs/requirements.txt b/docs/requirements.txt
index 20c2b820..0e7760be 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,4 +1,4 @@
 # Requirements for building docs
-sphinx==2.4.1
+sphinx==2.3.1
 sphinx-click
 doc8
diff --git a/src/sqlfluff/dialects/dialect_ansi.py b/src/sqlfluff/dialects/dialect_ansi.py
index cea93c05..addb10f1 100644
--- a/src/sqlfluff/dialects/dialect_ansi.py
+++ b/src/sqlfluff/dialects/dialect_ansi.py
@@ -491,8 +491,15 @@ class SelectTargetElementSegment(BaseSegment):
     parse_grammar = OneOf(
         # *
         Ref('StarSegment'),
-        # blah.*
-        Sequence(Ref('SingleIdentifierGrammar'), Ref('DotSegment'), Ref('StarSegment'), code_only=False),
+        # blah.* + blah.blah.*
+        Sequence(
+            Ref('SingleIdentifierGrammar'), Ref('DotSegment'),
+            Sequence(
+                Ref('SingleIdentifierGrammar'), Ref('DotSegment'),
+                optional=True
+            ),
+            Ref('StarSegment'), code_only=False
+        ),
         Sequence(
             OneOf(
                 Ref('LiteralGrammar'),

problem_statement: PRS Error: Found unparsable segment @L001P008: 'a.b.*...'
SQL query to reproduce:
```sql
SELECT a.b.* FROM t
```
repo: alanmcruickshank/sqlfluff
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/test/dialects_ansi_test.py b/test/dialects_ansi_test.py
index 91f29dc5..149b5e88 100644
--- a/test/dialects_ansi_test.py
+++ b/test/dialects_ansi_test.py
@@ -81,7 +81,10 @@ def test__dialect__ansi__file_from_raw(raw, res, caplog):
          "CAST(num AS INT64)"),
         # Casting as datatype with arguments
         ("SelectTargetElementSegment",
-         "CAST(num AS numeric(8,4))")
+         "CAST(num AS numeric(8,4))"),
+        # Wildcard field selection
+        ("SelectTargetElementSegment", "a.*"),
+        ("SelectTargetElementSegment", "a.b.*")
     ]
 )
 def test__dialect__ansi_specific_segment_parses(segmentref, raw, caplog):
task: metadata: install: pip install -e .
patch: diff --git a/src/sqlfluff/cli/commands.py b/src/sqlfluff/cli/commands.py
index 88fa54a9..d16999b7 100644
--- a/src/sqlfluff/cli/commands.py
+++ b/src/sqlfluff/cli/commands.py
@@ -205,7 +205,7 @@ def fix(force, paths, **kwargs):
     be interpreted like passing the current working directory as a path argument.
     """
     c = get_config(**kwargs)
-    lnt = get_linter(c)
+    lnt = get_linter(c, silent=('-',) == paths)
     verbose = c.get('verbose')
 
     config_string = format_config(lnt, verbose=verbose)
@@ -221,7 +221,7 @@ def fix(force, paths, **kwargs):
     if ('-',) == paths:
         stdin = sys.stdin.read()
         result = lnt.lint_string_wrapped(stdin, fname='stdin', verbosity=verbose, fix=True)
-        stdout = result.paths[0].files[0].fix_string(verbosity=verbose)
+        stdout = result.paths[0].files[0].fix_string(verbosity=verbose)[0]
         click.echo(stdout, nl=False)
         sys.exit()
 

problem_statement: Fix from stdin writes more than the fixed sql to stdout
When it was originally written, fixing from stdin printed the fixed sql to stdout and noting else. That way you could do things like 

```sh
echo ' select * from t' | sqlfluff fix - --rules L003 > fixed.sql
```
At least in 0.3.3, a lint result gets printed out, and the fixed string is printed as a python tuple:

```sh
bash-3.2$ sqlfluff version
0.3.3
bash-3.2$ echo ' select * from t' | sqlfluff fix - --rules L003
== [stdin] FAIL
L:   1 | P:   2 | L003 | First line has unexpected indent
('select * from t\n', True)
```


repo: alanmcruickshank/sqlfluff
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/test/cli_commands_test.py b/test/cli_commands_test.py
index c9b50a61..15a9126b 100644
--- a/test/cli_commands_test.py
+++ b/test/cli_commands_test.py
@@ -199,17 +199,14 @@ def test__cli__command__fix(rule, fname):
 #         generic_roundtrip_test(test_file, rule, fix_exit_code=1, final_exit_code=65)
 
 
-def test__cli__command_fix_stdin(monkeypatch):
+@pytest.mark.parametrize('stdin,rules,stdout', [
+    ('select * from t', 'L003', 'select * from t'),  # no change
+    (' select * from t', 'L003', 'select * from t'),  # fix preceding whitespace
+])
+def test__cli__command_fix_stdin(stdin, rules, stdout):
     """Check stdin input for fix works."""
-    sql = 'select * from tbl'
-    expected = 'fixed sql!'
-
-    def _patched_fix(self, verbosity=0):
-        return expected
-
-    monkeypatch.setattr("sqlfluff.linter.LintedFile.fix_string", _patched_fix)
-    result = invoke_assert_code(args=[fix, ('-', '--rules', 'L001')], cli_input=sql)
-    assert result.output == expected
+    result = invoke_assert_code(args=[fix, ('-', '--rules', rules)], cli_input=stdin)
+    assert result.output == stdout
 
 
 @pytest.mark.parametrize('rule,fname,prompt,exit_code', [
task: metadata: install: pip install -e .
patch: diff --git a/voluptuous/validators.py b/voluptuous/validators.py
index 8c6a86d..81566b9 100644
--- a/voluptuous/validators.py
+++ b/voluptuous/validators.py
@@ -192,12 +192,13 @@ class _WithSubValidators(object):
     def __init__(self, *validators, **kwargs):
         self.validators = validators
         self.msg = kwargs.pop('msg', None)
+        self.required = kwargs.pop('required', False)
 
     def __voluptuous_compile__(self, schema):
-        self._compiled = [
-            schema._compile(v)
-            for v in self.validators
-        ]
+        self._compiled = []
+        for v in self.validators:
+            schema.required = self.required
+            self._compiled.append(schema._compile(v))
         return self._run
 
     def _run(self, path, value):

problem_statement: Regression with Any and required
Hi,

I've observed a change of behaviour in the recent version of voluptuous

Here is a sample

```
from voluptuous import Schema, Any, Optional, All, Length

anyschema = Schema(Any({
    'name': All(unicode, Length(min=1, max=128)),
    Optional('protected'): bool,
}, {
    'name': All(unicode, Length(min=1, max=128)),
    Optional('dynamic_ip_required'): bool,
}, required=True))

try:
    anyschema({})
except Exception as e:
    print(e)
```	

```
$ sudo pip install 'voluptuous==0.11.5'
$ python t.py 
```
no output

```
$ sudo pip install 'voluptuous==0.10.5'
$ python t.py 
required key not provided @ data['name']
```

My understanding is the behavior of 0.10.5 is correct as we want a "required schema"
But it is not the case with 0.11.5 and above, required seem to be ignored

Is it normal?


repo: alecthomas/voluptuous
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/voluptuous/tests/tests.py b/voluptuous/tests/tests.py
index bc16a12..f2db8da 100644
--- a/voluptuous/tests/tests.py
+++ b/voluptuous/tests/tests.py
@@ -1322,3 +1322,30 @@ def test_strip_util_handles_various_inputs():
     assert Strip(u"3") == u"3"
     assert Strip(b'\xe2\x98\x83'.decode("UTF-8")) == b'\xe2\x98\x83'.decode("UTF-8")
     assert Strip(u" aaa ") == u"aaa"
+
+
+def test_any_required():
+    schema = Schema(Any({'a': int}, {'b': str}, required=True))
+
+    try:
+        schema({})
+    except MultipleInvalid as e:
+        assert_equal(str(e),
+                     "required key not provided @ data['a']")
+    else:
+        assert False, "Did not raise Invalid for MultipleInvalid"
+
+
+def test_any_required_with_subschema():
+    schema = Schema(Any({'a': Any(float, int)},
+                        {'b': int},
+                        {'c': {'aa': int}},
+                    required=True))
+
+    try:
+        schema({})
+    except MultipleInvalid as e:
+        assert_equal(str(e),
+                     "required key not provided @ data['a']")
+    else:
+        assert False, "Did not raise Invalid for MultipleInvalid"
task: metadata: install: pip install -e .
patch: diff --git a/text_to_num/lang/spanish.py b/text_to_num/lang/spanish.py
index cecbf8d..679ccde 100644
--- a/text_to_num/lang/spanish.py
+++ b/text_to_num/lang/spanish.py
@@ -61,6 +61,10 @@ STENS: Dict[str, int] = {
     )
 }
 
+STENS["veintitrés"] = 23
+STENS["veintidós"] = 22
+
+
 # Ten multiples
 # Ten multiples may be followed by a unit only;
 MTENS: Dict[str, int] = {

problem_statement: Spanish numbers like ciento veintitrés not correctly converted
The number "ciento veintitrés" in Spanish is converted to 100 instead of 123. It seems "veintitrés" is not recognized.
repo: allo-media/text2num
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_text_to_num_es.py b/tests/test_text_to_num_es.py
index 7633952..e6974ae 100644
--- a/tests/test_text_to_num_es.py
+++ b/tests/test_text_to_num_es.py
@@ -38,6 +38,8 @@ class TestTextToNumES(TestCase):
         self.assertEqual(text2num("diecinueve", "es"), 19)
         self.assertEqual(text2num("veinte", "es"), 20)
         self.assertEqual(text2num("veintiuno", "es"), 21)
+        self.assertEqual(text2num("veintitres", "es"), 23)
+        self.assertEqual(text2num("veintitrés", "es"), 23)
         self.assertEqual(text2num("treinta", "es"), 30)
         self.assertEqual(text2num("treinta y uno", "es"), 31)
         self.assertEqual(text2num("treinta y dos", "es"), 32)
task: metadata: install: pip install -e .
patch: diff --git a/wordcloud/wordcloud.py b/wordcloud/wordcloud.py
index ae5d107..e63d922 100644
--- a/wordcloud/wordcloud.py
+++ b/wordcloud/wordcloud.py
@@ -348,7 +348,11 @@ class WordCloud(object):
         """
         # make sure frequencies are sorted and normalized
         frequencies = sorted(frequencies.items(), key=item1, reverse=True)
+        if len(frequencies) <= 0:
+            raise ValueError("We need at least 1 word to plot a word cloud, "
+                             "got %d." % len(frequencies))
         frequencies = frequencies[:self.max_words]
+
         # largest entry will be 1
         max_frequency = float(frequencies[0][1])
 
@@ -360,10 +364,6 @@ class WordCloud(object):
         else:
             random_state = Random()
 
-        if len(frequencies) <= 0:
-            print("We need at least 1 word to plot a word cloud, got %d."
-                  % len(frequencies))
-
         if self.mask is not None:
             mask = self.mask
             width = mask.shape[1]

problem_statement: Checking 'frequencies' list in function WordCloud.generate_from_frequencies()
I'm having an issue related to the generation of the word_cloud from a list of frequencies per word. As you can see below, the function is trying to retrieve the max frequency from a list 'frecuencies', but it doesn't check before if there is some element in that list:

https://github.com/amueller/word_cloud/blob/master/wordcloud/wordcloud.py#L350

That kind of check is done after, in the following snippet (but it's too late, because we already tried to access to the first element on a probably empty list):

https://github.com/amueller/word_cloud/blob/master/wordcloud/wordcloud.py#L360-L362

In my own version, I've done the following correction related to the first snippet in order to avoid some crashes (just as an example):

``` 
        try:
            max_frequency = float(frequencies[0][1])
        except:
            print "ERROR with list 'frecuencies'=", frequencies
```

Best regards!


repo: amueller/word_cloud
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/test/test_wordcloud.py b/test/test_wordcloud.py
index ee91f2e..2d2662b 100644
--- a/test/test_wordcloud.py
+++ b/test/test_wordcloud.py
@@ -76,6 +76,16 @@ def test_multiple_s():
     assert_in("flosss", wc.words_)
 
 
+def test_empty_text():
+    # test originally empty text raises an exception
+    wc = WordCloud(stopwords=[])
+    assert_raises(ValueError, wc.generate, '')
+
+    # test empty-after-filtering text raises an exception
+    wc = WordCloud(stopwords=['a', 'b'])
+    assert_raises(ValueError, wc.generate, 'a b a')
+
+
 def test_default():
     # test that default word cloud creation and conversions work
     wc = WordCloud(max_words=50)
task: metadata: install: pip install -e .[dev]
patch: diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py
index df4d861..b0bb898 100644
--- a/sqlparse/filters/others.py
+++ b/sqlparse/filters/others.py
@@ -26,6 +26,13 @@ class StripCommentsFilter(object):
             if (prev_ is None or next_ is None or
                     prev_.is_whitespace or prev_.match(T.Punctuation, '(') or
                     next_.is_whitespace or next_.match(T.Punctuation, ')')):
+                # Insert a whitespace to ensure the following SQL produces
+                # a valid SQL. For example:
+                #
+                # Before: select a--comment\nfrom foo
+                # After: select a from foo
+                if prev_ is not None and next_ is None:
+                    tlist.tokens.insert(tidx, sql.Token(T.Whitespace, ' '))
                 tlist.tokens.remove(token)
             else:
                 tlist.tokens[tidx] = sql.Token(T.Whitespace, ' ')

problem_statement: strip_comments causing syntax error
If there is no space between comments and keyword, the output causes a syntax error. Here's an example:

```python
import sqlparse

sql='''select * from table1--this is a comment
inner join table2 on table1.id = table2.id--this is a comment
where table1.a=1'''

sqlparse.format(sql,strip_comments=True)
```
This gives the following as output:
`select * from table1inner join table2 on table1.id = table2.idwhere table1.a=1`
repo: andialbrecht/sqlparse
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_format.py b/tests/test_format.py
index 72af62e..aff07c1 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -50,6 +50,19 @@ class TestFormat(object):
         sql = 'select-- foo\nfrom -- bar\nwhere'
         res = sqlparse.format(sql, strip_comments=True)
         assert res == 'select from where'
+        sql = 'select *-- statement starts here\n\nfrom foo'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select * from foo'
+        sql = 'select * from foo-- statement starts here\nwhere'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select * from foo where'
+        sql = 'select a-- statement starts here\nfrom foo'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select a from foo'
+        sql = '--comment\nselect a-- statement starts here\n' \
+              'from foo--comment\nf'
+        res = sqlparse.format(sql, strip_comments=True)
+        assert res == 'select a from foo f'
 
     def test_strip_comments_invalid_option(self):
         sql = 'select-- foo\nfrom -- bar\nwhere'
task: metadata: install: pip install -e .[dev]
patch: diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index 175ae8e..2fb0a4c 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -91,13 +91,20 @@ def group_tzcasts(tlist):
     def match(token):
         return token.ttype == T.Keyword.TZCast
 
-    def valid(token):
+    def valid_prev(token):
         return token is not None
 
+    def valid_next(token):
+        return token is not None and (
+            token.is_whitespace
+            or token.match(T.Keyword, 'AS')
+            or token.match(*sql.TypedLiteral.M_CLOSE)
+        )
+
     def post(tlist, pidx, tidx, nidx):
         return pidx, nidx
 
-    _group(tlist, sql.Identifier, match, valid, valid, post)
+    _group(tlist, sql.Identifier, match, valid_prev, valid_next, post)
 
 
 def group_typed_literal(tlist):

problem_statement: Space removed in the extract presto function after query formatting. 
```
sqlparse.format( "SELECT extract(HOUR from from_unixtime(hour_ts) AT TIME ZONE 'America/Los_Angeles') from table", reindent=True)
```
removes space between `from` and `from_unixtime(hour_ts` in the 0.3.1 version, works fine in 0.3.0

Related superset PR: https://github.com/apache/incubator-superset/pull/10165

Expected
```
SELECT extract(HOUR
               from from_unixtime(hour_ts) AT TIME ZONE 'America/Los_Angeles')
from table
```

Actual
```
SELECT extract(HOUR
               fromfrom_unixtime(hour_ts) AT TIME ZONE 'America/Los_Angeles')
from table
```
repo: andialbrecht/sqlparse
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index 38d1840..4ffc69f 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -401,6 +401,15 @@ def test_issue489_tzcasts():
     assert p.tokens[-1].get_alias() == 'foo'
 
 
+def test_issue562_tzcasts():
+    # Test that whitespace between 'from' and 'bar' is retained
+    formatted = sqlparse.format(
+        'SELECT f(HOUR from bar AT TIME ZONE \'UTC\') from foo', reindent=True
+    )
+    assert formatted == \
+           'SELECT f(HOUR\n         from bar AT TIME ZONE \'UTC\')\nfrom foo'
+
+
 def test_as_in_parentheses_indents():
     # did raise NoneType has no attribute is_group in _process_parentheses
     formatted = sqlparse.format('(as foo)', reindent=True)