Skip to content

Commit

Permalink
python3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dacjames committed Mar 21, 2015
1 parent 1d2e096 commit 7489fbf
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Elm Language Support.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from __future__ import print_function
try:
import Queue as queue
except ImportError as py3err:
import queue

import os
import subprocess
import json
import threading
import Queue
import time
from collections import defaultdict

Expand Down Expand Up @@ -47,13 +52,13 @@ def run(self):
while True:
func, args, kargs = self.tasks.get()
try: func(*args, **kargs)
except Exception, e: print e
except Exception as e: print(e)
self.tasks.task_done()

class ThreadPool(object):
"""Pool of threads consuming tasks from a queue"""
def __init__(self, num_threads):
self.tasks = Queue.Queue(num_threads)
self.tasks = queue.Queue(num_threads)
for _ in range(num_threads): Worker(self.tasks)

def add_task(self, func, *args, **kargs):
Expand Down Expand Up @@ -121,7 +126,7 @@ def load_dependency_docs(name):
f = os.path.join(root, filename)
if not '_internals' in f:
source_files.append((f, filename))
queue = Queue.Queue()
queue = queue.Queue()
global POOL
threads = [POOL.add_task(threadload, f[0], directory, queue) for f in source_files]
POOL.wait_completion()
Expand Down Expand Up @@ -362,7 +367,7 @@ def load_dependencies(self, filename):

class ElmShowType(sublime_plugin.TextCommand):
def run(self, edit):
print get_type(self.view)
print(get_type(self.view))
msg = get_type(self.view) or ''
sublime.status_message(msg)

Expand All @@ -372,7 +377,7 @@ def run(self):
version = p.communicate()[0].strip() or ''
if version.endswith('docs.json'):
SETTINGS.set('elm_docs_path', version)
print version or 'elm-paths not installed...'
print(version or 'elm-paths not installed...')

class ElmEnable(sublime_plugin.ApplicationCommand):
def run(self):
Expand Down Expand Up @@ -407,7 +412,7 @@ def previous_line(self, x):
line = view.line(x)
return view.line(line.begin() - 1)

class ElmCase(sublime_plugin.TextCommand):
class ElmCase(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
sel = view.sel()
Expand Down

0 comments on commit 7489fbf

Please sign in to comment.