Optimize Stream.filter
authorHarmon <Harmon758@gmail.com>
Sat, 23 Jan 2021 20:21:04 +0000 (14:21 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 23 Jan 2021 20:21:04 +0000 (14:21 -0600)
tweepy/streaming.py

index 4274794c07c6e5917fa0dcd39c8bdd82bd7e8b33..ece9fe2a1bf89feb63c3080d273ab6592867e573 100644 (file)
@@ -245,10 +245,10 @@ class Stream:
         if track:
             body['track'] = ','.join(track)
         if locations and len(locations) > 0:
-            if len(locations) % 4 != 0:
+            if len(locations) % 4:
                 raise TweepError("Wrong number of locations points, "
                                  "it has to be a multiple of 4")
-            body['locations'] = ','.join([f'{l:.4f}' for l in locations])
+            body['locations'] = ','.join(f'{l:.4f}' for l in locations)
         if filter_level:
             body['filter_level'] = filter_level
         if languages: