Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Prefer format() over string interpolation operator" issue #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def plugin_loaded():
settings.set('max_gists', 100) # the URLs are not updated.
sublime.status_message("Gist: GitHub API does not support a value of higher than 100")

MAX_GISTS = '?per_page=%d' % settings.get('max_gists')
MAX_GISTS = '?per_page={0:d}'.format(settings.get('max_gists'))

api_url = settings.get('api_url') # Should add validation?
settings.set('GISTS_URL', api_url + '/gists' + MAX_GISTS)
Expand Down Expand Up @@ -184,10 +184,10 @@ def on_gist_filename(filename):
else:
if filename:
(namepart, extpart) = os.path.splitext(filename)
make_filename = lambda num: "%s (%d)%s" % (namepart, num, extpart)
make_filename = lambda num: "{0!s} ({1:d}){2!s}".format(namepart, num, extpart)
else:
syntax_name, _ = os.path.splitext(os.path.basename(self.view.settings().get('syntax')))
make_filename = lambda num: "%s %d" % (syntax_name, num)
make_filename = lambda num: "{0!s} {1:d}".format(syntax_name, num)
gist_data = dict((make_filename(idx), data) for idx, data in enumerate(region_data, 1))

gist = create_gist(self.public, description, gist_data)
Expand All @@ -197,7 +197,7 @@ def on_gist_filename(filename):

gist_html_url = gist['html_url']
sublime.set_clipboard(gist_html_url)
sublime.status_message("%s Gist: %s" % (self.mode(), gist_html_url))
sublime.status_message("{0!s} Gist: {1!s}".format(self.mode(), gist_html_url))

if gistify:
gistify_view(self.view, gist, list(gist['files'].keys())[0])
Expand Down
2 changes: 1 addition & 1 deletion helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def gistify_view(view, gist, gist_filename):
if not view.file_name():
view.set_name(gist_filename)
elif os.path.basename(view.file_name()) != gist_filename:
statusline_string = "%s (%s)" % (statusline_string, gist_filename)
statusline_string = "{0!s} ({1!s})".format(statusline_string, gist_filename)

view.settings().set('gist_html_url', gist["html_url"])
view.settings().set('gist_description', gist['description'])
Expand Down