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

Add support for Sublime Text 3 #3

Closed
Closed
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
4 changes: 2 additions & 2 deletions isort/isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
from sys import path as PYTHONPATH
from sys import stderr, stdout

from natsort import natsorted
from pies import *
from isort.natsort import natsorted
from isort.pies import *

from . import settings

Expand Down
2 changes: 1 addition & 1 deletion isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import os
from collections import namedtuple

from pies import *
from isort.pies import *

WrapModes = ('GRID', 'VERTICAL', 'HANGING_INDENT', 'VERTICAL_HANGING_INDENT', 'VERTICAL_GRID', 'VERTICAL_GRID_GROUPED')
WrapModes = namedtuple('WrapModes', WrapModes)(*range(len(WrapModes)))
Expand Down
2 changes: 1 addition & 1 deletion isort_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sublime
import sublime_plugin
from isort import SortImports
from .isort import SortImports


class IsortCommand(sublime_plugin.TextCommand):
Expand Down
6 changes: 6 additions & 0 deletions natsort/natsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@

"""

try:
basestring
except NameError:
basestring = str


import re
# The regex that locates version numbers and floats
float_re = re.compile(r'([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)')
Expand Down
127 changes: 0 additions & 127 deletions ordereddict.py

This file was deleted.

5 changes: 1 addition & 4 deletions pies.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ def xrange(*args):
urllib.unquote_plus = parse.unquote_plus
urllib.urlencode = parse.urlencode
else:
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from collections import OrderedDict
Copy link
Owner

Choose a reason for hiding this comment

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

this will probably break ST2 installs, why did you remove the try/except?

My st2 install gives me this version:

>>> import sys
>>> print (sys.version)
2.6.7 (r267:88850, Oct 11 2012, 20:15:00) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]

http://docs.python.org/2/library/collections.html#collections.OrderedDict
If you look there, ordereddict was added in v2.7

Copy link
Author

Choose a reason for hiding this comment

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

Oh, you're right, I misread. I thought it was added in 2.4 but now I see that it's collections that was added in 2.4, and OrderedDict was added in 2.7.

I removed it because ordereddict.OrderedDict depends on UserDict which doesn't exist in python 3 and leads to an import error. I'll add an if statement and send another pull request. Good call!

Copy link
Owner

Choose a reason for hiding this comment

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

No worries. I'll merge the PR as soon as this gets fixed. Thanks for your contribution!


import codecs

Expand Down