Closed francis-de-ladu closed 1 year ago
Hi @francis-de-ladu, are you trying to align python and is it possible to share a sample snippet of the code you are trying to align?
import argparse
import pandas as pd
import tweepy
import sys
from TwitterApi import ApiHandle
# Api keys to be used to authenticate to Twitter's api.
API_KEY = "API_KEY"
API_SECRET = "API_SECRET"
api = ApiHandle(API_KEY, API_SECRET)
attributes = {
'id_str': 'id_str',
'created_at': 'created_at',
'author_screen_name': ['author', 'screen_name'],
'author_id_str': ['author', 'id_str'],
'source': 'source',
'lang': 'lang',
'full_text': 'full_text',
'favorite_count': 'favorite_count',
'retweet_count': 'retweet_count',
'is_quote_status': 'is_quote_status',
'quoted_status_id_str': 'quoted_status_id_str',
'in_reply_to_screen_name': 'in_reply_to_screen_name',
'in_reply_to_status_id_str': 'in_reply_to_status_id_str',
'entities': 'entities',
# 'retweets': 'retweets',
# NEED INVESTIGATION
# 'quoted_status': 'quoted_status',
# 'retweeted_status': 'retweeted_status',
# OBJECTS
# 'coordinates': 'coordinates',
# 'geo': 'geo',
# 'place': 'place',
}
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Script to fetch tweets from the last seven days according to some criterion.')
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--user', metavar='username', type=str, default=None,
help='the user from whom to fetch the tweets')
group.add_argument('--text', metavar='text_query', type=str, default=None,
help='the string to look for to fetch the tweets')
group.add_argument('--ids', metavar='N', type=int, nargs='+', default=None,
help='a list of tweet IDs to fetch')
parser.add_argument('--count', metavar='N', type=int, default=100,
help='the number of tweets to fetch (default 100)')
args = parser.parse_args()
print(args)
if args.user:
api.tweets_from_username(
username=args.user, count=args.count, attributes=attributes)
elif args.text:
api.tweets_from_text_query(
text_query=args.text, count=args.count, attributes=attributes)
elif args.ids:
api.tweets_from_ids(ids=args.ids, attributes=attributes)
else:
raise "This should never happen!"
The problem doesn't happen when I remove what's commented inside the brackets, but it still doesn't align colons as expected.
[Enter steps to reproduce:]
Atom: 1.45.0 x64 Electron: 4.2.7 OS: Linux Mint Thrown From: aligner package 1.2.4
Stack Trace
Uncaught TypeError: Cannot assign to read only property 'row' of object '[object Object]'
Commands
Non-Core Packages