Skip to content

upgrade to support python3.7#51

Open
jiahut wants to merge 5 commits into
khilnani:masterfrom
jiahut:master
Open

upgrade to support python3.7#51
jiahut wants to merge 5 commits into
khilnani:masterfrom
jiahut:master

Conversation

@jiahut

@jiahut jiahut commented Jun 4, 2019

Copy link
Copy Markdown

fix the grammar error to support python3.7

@jiahut

jiahut commented Jun 4, 2019

Copy link
Copy Markdown
Author

refer to #50

@jiahut

jiahut commented Jun 10, 2019

Copy link
Copy Markdown
Author

add the open action

Comment thread gists_cli/actions.py
# display line delims only if more than one file exists. facilitates piping file content
noDelim = len(gist['files']) == 1 or fileName != ''
for (file, data) in gist['files'].items():
for (file, data) in list(gist['files'].items()):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not so sure why the parentheses are necessary on this line. I think it could be

for file, data in gist['files'].items():

Comment thread gists_cli/actions.py
target = os.path.join(path,id)

print ('Gist \'{0}\' has {1} file(s)'.format(id, len(gist['files'])))
print(('Gist \'{0}\' has {1} file(s)'.format(id, len(gist['files']))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for extra parentheses.

Comment thread gists_cli/actions.py
print(('Gist \'{0}\' has {1} file(s)'.format(id, len(gist['files']))))
for file in gist['files']:
print (' ' + file)
print((' ' + file))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment thread gists_cli/actions.py
print("Error message: " + str(e))
else:
print 'Ok. I won\'t download the Gist.'
print('Ok. I won\'t download the Gist.')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to standardize on double or single quotes rather than both.

Comment thread gists_cli/actions.py
oldgist['description'] = description
if content and content != '?':
for (file, data) in oldgist['files'].items():
for (file, data) in list(oldgist['files'].items()):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, no paren needed

Comment thread gists_cli/actions.py
gist = _get_gist(id)

print ('Gist \'{0}\' Description: {1}'.format(id, gist['description']))
print(('Gist \'{0}\' Description: {1}'.format(id, gist['description'])))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Comment thread gists_cli/actions.py
print(('Gist \'{0}\' Description: {1}'.format(id, gist['description'])))
for file in gist['files']:
print (' ' + file)
print((' ' + file))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment thread gists_cli/actions.py
print(textwrap.fill('An easy to use CLI to manage your GitHub Gists. Create, edit, append, view, search and backup your Gists.', defaults.max_width))
print('')
print('Author: Nik Khilnani - https://github.com/khilnani/gists.cli')
print('')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be preferable to just add \n to the end of other print statements rather than printing out empty strings

Comment thread gists_cli/api.py
log.debug('OTP not required.')
else:
print 'Github rejected the username and password but didnt send an OTP header. Try again please'
print('Github rejected the username and password but didnt send an OTP header. Try again please')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*didn't

Comment thread gists_cli/api.py
sys.exit(0)
else:
print 'Uknown Error: ' + str(code)
print('Uknown Error: ' + str(code))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could take advantage of python3's format here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants