From 9ad912aec5f9ac3d98197c3a7940570ebc2a36c9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 1 Aug 2021 17:23:32 +0100 Subject: [PATCH] Tidying --- posts.py | 13 +++---------- tests.py | 9 +++++---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/posts.py b/posts.py index 9d503c872..84a819697 100644 --- a/posts.py +++ b/posts.py @@ -205,8 +205,6 @@ def parseUserFeed(session, feedUrl: str, asHeader: {}, pprint(feedJson) if 'orderedItems' in feedJson: - #for item in feedJson['orderedItems']: - # yield item return feedJson['orderedItems'] nextUrl = None @@ -217,7 +215,7 @@ def parseUserFeed(session, feedUrl: str, asHeader: {}, if debug: print('User feed next url: ' + str(nextUrl)) - + if nextUrl: if isinstance(nextUrl, str): if '?max_id=0' not in nextUrl: @@ -225,15 +223,11 @@ def parseUserFeed(session, feedUrl: str, asHeader: {}, parseUserFeed(session, nextUrl, asHeader, projectVersion, httpPrefix, domain, debug, depth + 1) - if userFeed: - #for item in userFeed: - # yield item + if userFeed: return userFeed elif isinstance(nextUrl, dict): userFeed = nextUrl if userFeed.get('orderedItems'): - #for item in userFeed['orderedItems']: - # yield item return userFeed['orderedItems'] return None @@ -546,8 +540,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int, "plaintext": _cleanHtml(content), "attachment": attachment, "mentions": mentions, - "emoji": emoji, - "conversation": conversation + "emoji": emoji } i += 1 diff --git a/tests.py b/tests.py index 1ace7f9ce..1dff6159e 100644 --- a/tests.py +++ b/tests.py @@ -1475,7 +1475,8 @@ def testGroupFollow(): assert validInboxFilenames(testgroupDir, 'testgroup', testgroupDomain, aliceDomain, alicePort) assert 'alice@' + aliceDomain in open(testgroupFollowersFilename).read() - assert '!alice@' + aliceDomain not in open(testgroupFollowersFilename).read() + assert '!alice@' + aliceDomain not in \ + open(testgroupFollowersFilename).read() testgroupWebfingerFilename = \ testgroupDir + '/wfendpoints/testgroup@' + \ @@ -1573,7 +1574,7 @@ def testGroupFollow(): print('\n\n*********************************************************') print('Alice posts to the test group') inboxPathBob = \ - bobDir + '/accounts/bob@' + bobDomain + '/inbox' + bobDir + '/accounts/bob@' + bobDomain + '/inbox' startPostsBob = \ len([name for name in os.listdir(inboxPathBob) if os.path.isfile(os.path.join(inboxPathBob, name))]) @@ -1620,7 +1621,7 @@ def testGroupFollow(): print('\n\n*********************************************************') print('Check that post was relayed from test group to bob') -# bobMessageArrived = False + # bobMessageArrived = False for i in range(20): time.sleep(1) if os.path.isdir(inboxPathBob): @@ -1628,7 +1629,7 @@ def testGroupFollow(): len([name for name in os.listdir(inboxPathBob) if os.path.isfile(os.path.join(inboxPathBob, name))]) if currPostsBob > startPostsBob: -# bobMessageArrived = True + # bobMessageArrived = True print('Bob received relayed group post!') break