You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/02/10 22:45:02 UTC

[allura] 31/41: [#8349] python-modernize -n -w --no-diffs -f itertools_six -f itertools_imports_six .

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8349
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 01bfc18b2f201a8e2b0b07d5955811b0f1c4e72f
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Feb 10 15:23:59 2020 -0500

    [#8349] python-modernize -n -w --no-diffs -f itertools_six -f itertools_imports_six .
---
 Allura/allura/ext/personal_dashboard/dashboard_main.py |  5 +++--
 Allura/allura/lib/search.py                            | 11 ++++++-----
 AlluraTest/alluratest/test_syntax.py                   |  5 +++--
 ForgeActivity/forgeactivity/main.py                    |  7 ++++---
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/Allura/allura/ext/personal_dashboard/dashboard_main.py b/Allura/allura/ext/personal_dashboard/dashboard_main.py
index 15f9f8f..2df14f0 100644
--- a/Allura/allura/ext/personal_dashboard/dashboard_main.py
+++ b/Allura/allura/ext/personal_dashboard/dashboard_main.py
@@ -21,7 +21,7 @@ import logging
 
 from tg import tmpl_context as c, app_globals as g
 from tg import expose, redirect, config
-from itertools import islice, ifilter
+from itertools import islice
 from ming.orm import session
 
 from allura.model.timeline import perm_check, get_activity_object
@@ -30,6 +30,7 @@ from allura.controllers.feed import FeedController
 from allura.lib.widgets.user_profile import SectionBase, SectionsUtil, ProjectsSectionBase
 from allura.lib.widgets import form_fields as ffw
 from paste.deploy.converters import asbool
+from six.moves import filter
 
 log = logging.getLogger(__name__)
 
@@ -152,7 +153,7 @@ class ActivitySection(DashboardSectionBase):
             self.user, page=0, limit=100,
             actor_only=False,
         )
-        filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline),
+        filtered_timeline = list(islice(filter(perm_check(c.user), full_timeline),
                                         0, 8))
         for activity in filtered_timeline:
             # Get the project for the activity.obj so we can use it in the
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 78922ef..4c5dab9 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -20,7 +20,7 @@ from __future__ import absolute_import
 import re
 import socket
 from logging import getLogger
-from itertools import imap
+
 
 import bson
 import markdown
@@ -34,6 +34,7 @@ from allura.lib import helpers as h
 from allura.lib.solr import escape_solr_arg
 from allura.lib.utils import urlencode
 import six
+from six.moves import map
 
 log = getLogger(__name__)
 
@@ -321,12 +322,12 @@ def search_app(q='', fq=None, app=True, **kw):
                 else:
                     return doc
 
-            filtered_results = [_f for _f in imap(filter_unauthorized, results) if _f]
+            filtered_results = [_f for _f in map(filter_unauthorized, results) if _f]
             count -= len(results) - len(filtered_results)
             results = filtered_results
-            results = imap(historize_urls, results)
-            results = imap(add_matches, results)
-            results = imap(paginate_comment_urls, results)
+            results = map(historize_urls, results)
+            results = map(add_matches, results)
+            results = map(paginate_comment_urls, results)
 
     # Provide sort urls to the view
     score_url = 'score desc'
diff --git a/AlluraTest/alluratest/test_syntax.py b/AlluraTest/alluratest/test_syntax.py
index 74a74ec..db3621c 100644
--- a/AlluraTest/alluratest/test_syntax.py
+++ b/AlluraTest/alluratest/test_syntax.py
@@ -20,8 +20,9 @@ from __future__ import absolute_import
 import os.path
 from subprocess import Popen, PIPE
 import sys
-from itertools import izip_longest
+
 from unittest import SkipTest
+from six.moves import zip_longest
 
 toplevel_dir = os.path.abspath(os.path.dirname(__file__) + "/../..")
 
@@ -42,7 +43,7 @@ find_py = "find Allura Forge* -name '*.py'"
 def grouper(n, iterable, fillvalue=None):
     "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
     args = [iter(iterable)] * n
-    return izip_longest(fillvalue=fillvalue, *args)
+    return zip_longest(fillvalue=fillvalue, *args)
 
 
 def test_no_local_tz_functions():
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 4888fa7..5f1c78b 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -20,7 +20,7 @@ from __future__ import absolute_import
 import logging
 import calendar
 from datetime import timedelta
-from itertools import islice, ifilter
+from itertools import islice
 
 from bson import ObjectId
 from ming.orm import session
@@ -46,6 +46,7 @@ from allura.lib.widgets.form_fields import PageList
 from allura.ext.user_profile import ProfileSectionBase
 
 from .widgets.follow import FollowToggle
+from six.moves import filter
 
 log = logging.getLogger(__name__)
 
@@ -123,7 +124,7 @@ class ForgeActivityController(BaseController):
         timeline = g.director.get_timeline(followee, page,
                                            limit=extra_limit,
                                            actor_only=actor_only)
-        filtered_timeline = list(islice(ifilter(perm_check(c.user), timeline),
+        filtered_timeline = list(islice(filter(perm_check(c.user), timeline),
                                         0, limit))
         if extra_limit == limit:
             # if we didn't ask for extra, then we expect there's more if we got all we asked for
@@ -290,7 +291,7 @@ class ForgeActivityProfileSection(ProfileSectionBase):
             self.user, page=0, limit=100,
             actor_only=True,
         )
-        filtered_timeline = list(islice(ifilter(perm_check(c.user), full_timeline),
+        filtered_timeline = list(islice(filter(perm_check(c.user), full_timeline),
                                         0, 8))
         for activity in filtered_timeline:
             # Get the project for the activity.obj so we can use it in the