I'm having this error when trying to remove topics in a List[Tuple[Union[bytes, str], Union[dict, dict]]]
Here a sample of the list:
analyzed_comments = [('setup.py', {'Topic_0': ['version', 'get'], 'Topic_1': ['version', 'get']}),
('translation.py', {'Topic_0': ['multiline', 'pattern', 'skip'], 'Topic_1': ['multiline', 'concat', 'text']})]
I would like to have a resulting list that stores:
- name of the file
- list of non redundant topics
Something like:
comment_topics = [('setup.py', ['version', 'get']),
('translation.py', ['multiline', 'pattern', 'skip', 'concat', 'text'])]
This is what I wrote, but it doesn't seem to do this job well:
comment_topics = list()
temp_comments = list()
for file, comment in analyzed_comments:
for topic in comment:
elem = body[topic]
temp_comments = list(set(elem + temp_comments))
tupla = (file, temp_comments)
comment_topics.append(tupla)
print(comment_topics)
have you got any ideas?