-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from tony/libtmux
Decouple tmux API into libtmux
- Loading branch information
Showing
22 changed files
with
586 additions
and
443 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .pane import Pane | ||
from .server import Server | ||
from .session import Session | ||
from .window import Window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# -*- coding: utf8 -*- | ||
import sys | ||
|
||
PY2 = sys.version_info[0] == 2 | ||
|
||
_identity = lambda x: x | ||
|
||
|
||
if PY2: | ||
unichr = unichr | ||
text_type = unicode | ||
string_types = (str, unicode) | ||
integer_types = (int, long) | ||
from urllib import urlretrieve | ||
|
||
text_to_native = lambda s, enc: s.encode(enc) | ||
|
||
iterkeys = lambda d: d.iterkeys() | ||
itervalues = lambda d: d.itervalues() | ||
iteritems = lambda d: d.iteritems() | ||
|
||
from cStringIO import StringIO as BytesIO | ||
from StringIO import StringIO | ||
import cPickle as pickle | ||
import ConfigParser as configparser | ||
|
||
from itertools import izip, imap | ||
range_type = xrange | ||
|
||
cmp = cmp | ||
|
||
input = raw_input | ||
from string import lower as ascii_lowercase | ||
import urlparse | ||
|
||
exec('def reraise(tp, value, tb=None):\n raise tp, value, tb') | ||
|
||
def implements_to_string(cls): | ||
cls.__unicode__ = cls.__str__ | ||
cls.__str__ = lambda x: x.__unicode__().encode('utf-8') | ||
return cls | ||
|
||
def console_to_str(s): | ||
return s.decode('utf_8') | ||
|
||
else: | ||
unichr = chr | ||
text_type = str | ||
string_types = (str,) | ||
integer_types = (int, ) | ||
|
||
text_to_native = lambda s, enc: s | ||
|
||
iterkeys = lambda d: iter(d.keys()) | ||
itervalues = lambda d: iter(d.values()) | ||
iteritems = lambda d: iter(d.items()) | ||
|
||
from io import StringIO, BytesIO | ||
import pickle | ||
import configparser | ||
|
||
izip = zip | ||
imap = map | ||
range_type = range | ||
|
||
cmp = lambda a, b: (a > b) - (a < b) | ||
|
||
input = input | ||
from string import ascii_lowercase | ||
import urllib.parse as urllib | ||
import urllib.parse as urlparse | ||
from urllib.request import urlretrieve | ||
|
||
console_encoding = sys.__stdout__.encoding | ||
|
||
implements_to_string = _identity | ||
|
||
def console_to_str(s): | ||
""" From pypa/pip project, pip.backwardwardcompat. License MIT. """ | ||
try: | ||
return s.decode(console_encoding) | ||
except UnicodeDecodeError: | ||
return s.decode('utf_8') | ||
|
||
def reraise(tp, value, tb=None): | ||
if value.__traceback__ is not tb: | ||
raise(value.with_traceback(tb)) | ||
raise value | ||
|
||
|
||
number_types = integer_types + (float,) |
Oops, something went wrong.