Commit ba374b33 authored by liuzheng712's avatar liuzheng712

style: use python3 at the head of file

parent fe7bcb81
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from .app import Coco from .app import Coco
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import datetime import datetime
import os import os
import time import time
...@@ -302,4 +306,4 @@ class Coco: ...@@ -302,4 +306,4 @@ class Coco:
"asset": session.server.asset.hostname, "asset": session.server.asset.hostname,
"system_user": session.server.system_user.username, "system_user": session.server.system_user.username,
"timestamp": int(time.time()) "timestamp": int(time.time())
}) })
\ No newline at end of file
#!coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
BACKSPACE_CHAR = {b'\x08': b'\x08\x1b[K', b'\x7f': b'\x08\x1b[K'} BACKSPACE_CHAR = {b'\x08': b'\x08\x1b[K', b'\x7f': b'\x08\x1b[K'}
ENTER_CHAR = [b'\r', b'\n', b'\r\n'] ENTER_CHAR = [b'\r', b'\n', b'\r\n']
......
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
...@@ -78,4 +78,4 @@ elif is_py3: ...@@ -78,4 +78,4 @@ elif is_py3:
builtin_str = str builtin_str = str
bytes = bytes bytes = bytes
str = str str = str
\ No newline at end of file
#!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#
""" """
coco.config coco.config
~~~~~~~~~~~~ ~~~~~~~~~~~~
......
# coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
class PermissionFailed(Exception): class PermissionFailed(Exception):
......
# coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import socket import socket
import threading import threading
import logging import logging
......
# coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import socket import socket
import json import json
import logging import logging
...@@ -14,7 +17,6 @@ from jms.models import User ...@@ -14,7 +17,6 @@ from jms.models import User
from .models import Request, Client, WSProxy from .models import Request, Client, WSProxy
from .interactive import InteractiveServer from .interactive import InteractiveServer
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
......
#!coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import logging import logging
import socket import socket
import threading import threading
......
#!coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import logging import logging
import paramiko import paramiko
......
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json import json
import threading import threading
import datetime import datetime
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
...@@ -80,7 +81,7 @@ class ServerReplayRecorder(ReplayRecorder): ...@@ -80,7 +81,7 @@ class ServerReplayRecorder(ReplayRecorder):
:return: :return:
""" """
# Todo: <liuzheng712@gmail.com> # Todo: <liuzheng712@gmail.com>
super().record_replay(data_set) # super().record_replay(data_set)
def session_start(self, session_id): def session_start(self, session_id):
print("When session {} start exec".format(session_id)) print("When session {} start exec".format(session_id))
...@@ -94,7 +95,7 @@ class ServerCommandRecorder(CommandRecorder): ...@@ -94,7 +95,7 @@ class ServerCommandRecorder(CommandRecorder):
def record_command(self, data_set): def record_command(self, data_set):
if not data_set: if not data_set:
return True return True
super().record_command(data_set) # super().record_command(data_set)
return self.app.service.push_session_command(data_set) return self.app.service.push_session_command(data_set)
def session_start(self, session_id): def session_start(self, session_id):
......
#!coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import threading import threading
import uuid import uuid
......
#! coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os import os
import logging import logging
......
#!coding: utf-8 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from __future__ import unicode_literals from __future__ import unicode_literals
...@@ -193,7 +195,8 @@ def is_obj_attr_has(obj, val, attrs=("hostname", "ip", "comment")): ...@@ -193,7 +195,8 @@ def is_obj_attr_has(obj, val, attrs=("hostname", "ip", "comment")):
if not attrs: if not attrs:
vals = [val for val in obj.__dict__.values() if isinstance(val, (str, int))] vals = [val for val in obj.__dict__.values() if isinstance(val, (str, int))]
else: else:
vals = [getattr(obj, attr) for attr in attrs if hasattr(obj, attr) and isinstance(hasattr(obj, attr), (str, int))] vals = [getattr(obj, attr) for attr in attrs if
hasattr(obj, attr) and isinstance(hasattr(obj, attr), (str, int))]
for v in vals: for v in vals:
if str(v).find(val) != -1: if str(v).find(val) != -1:
...@@ -363,5 +366,4 @@ def compile_message(): ...@@ -363,5 +366,4 @@ def compile_message():
pass pass
ugettext = _gettext() ugettext = _gettext()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import os import os
BASE_DIR = os.path.dirname(__file__) BASE_DIR = os.path.dirname(__file__)
......
#!/usr/bin/python #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# #
import os import os
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment