本文整理汇总了Python中msg.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_rename_buf
def on_rename_buf(self, data):
buf = self.FLOO_BUFS[int(data['id'])]
# This can screw up if someone else renames the buffer around the same time as us. Oh well.
buf = self.get_buf_by_path(utils.get_full_path(data['path']))
if not buf:
return super(Protocol, self).on_rename_buf(data)
msg.debug('We already renamed %s. Skipping' % buf['path'])
示例2: on_emacs_rename_buf
def on_emacs_rename_buf(self, req):
buf = self.get_buf_by_path(req['old_path'])
if not buf:
msg.debug('No buffer for path %s' % req['old_path'])
return
self.rename_buf(buf['id'], req['path'])
self.FLOO_BUFS[buf['id']]['path'] = utils.to_rel_path(req['path'])
示例3: put
def put(item):
if not item:
return
SOCKET_Q.put(json.dumps(item) + '\n')
qsize = SOCKET_Q.qsize()
if qsize > 0:
msg.debug('%s items in q' % qsize)
示例4: set_cursor_position
def set_cursor_position(self, offset):
line_num, col = self._offset_to_vim(offset)
command = 'setpos(".", [%s, %s, %s, %s])' % (self.native_id, line_num, col, 0)
msg.debug("setting pos: %s" % command)
rv = int(vim.eval(command))
if rv != 0:
msg.debug("SHIIIIIIIIT %s" % rv)
示例5: __init__
def __init__(self, parent, path, recurse=True):
self.parent = parent
self.size = 0
self.children = []
self.files = []
self.ignores = {
'/TOO_BIG/': []
}
self.path = utils.unfuck_path(path)
try:
paths = os.listdir(self.path)
except OSError as e:
if e.errno != errno.ENOTDIR:
msg.error('Error listing path %s: %s' % (path, unicode(e)))
return
self.path = os.path.dirname(self.path)
self.add_file(os.path.basename(path))
return
except Exception as e:
msg.error('Error listing path %s: %s' % (path, unicode(e)))
return
msg.debug('Initializing ignores for %s' % path)
for ignore_file in IGNORE_FILES:
try:
self.load(ignore_file)
except:
pass
if recurse:
for p in paths:
self.add_file(p)
示例6: put
def put(self, item):
if not item:
return
self.sock_q.put(json.dumps(item) + "\n")
qsize = self.sock_q.qsize()
if qsize > 0:
msg.debug("%s items in q" % qsize)
示例7: get_info
def get_info(workspace_url, project_dir):
repo_type = detect_type(project_dir)
if not repo_type:
return
msg.debug('Detected ', repo_type, ' repo in ', project_dir)
data = {
'type': repo_type,
}
cmd = REPO_MAPPING[repo_type]['cmd']
try:
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=project_dir)
result = p.communicate()
repo_url = result[0].decode('utf-8').strip()
if repo_type == 'svn':
repo_url = parse_svn_xml(repo_url)
msg.log(repo_type, ' url is ', repo_url)
if not repo_url:
msg.error('Error getting ', repo_type, ' url:', result[1])
return
except Exception as e:
msg.error('Error getting ', repo_type, ' url:', str_e(e))
return
data['url'] = repo_url
return data
示例8: on_highlight
def on_highlight(self, data):
# floobits.highlight(data['id'], region_key, data['username'], data['ranges'], data.get('ping', False))
# buf_id, region_key, username, ranges, ping=False):
ping = data.get("ping", False)
if self.follow_mode:
ping = True
buf = self.FLOO_BUFS[data["id"]]
view = self.get_view(data["id"])
if not view:
if not ping:
return
view = self.create_view(buf)
if not view:
return
if ping:
try:
offset = data["ranges"][0][0]
except IndexError as e:
msg.debug("could not get offset from range %s" % e)
else:
msg.log("You have been summoned by %s" % (data.get("username", "an unknown user")))
view.focus()
view.set_cursor_position(offset)
if G.SHOW_HIGHLIGHTS:
view.highlight(data["ranges"], data["user_id"])
示例9: __init__
def __init__(self, r):
self.body = None
if isinstance(r, bytes):
r = r.decode('utf-8')
if isinstance(r, str_instances):
lines = r.split('\n')
self.code = int(lines[0])
if self.code != 204:
self.body = json.loads('\n'.join(lines[1:]))
elif hasattr(r, 'code'):
# Hopefully this is an HTTPError
self.code = r.code
if self.code != 204:
self.body = json.loads(r.read().decode("utf-8"))
elif hasattr(r, 'reason'):
# Hopefully this is a URLError
# horrible hack, but lots of other stuff checks the response code :/
self.code = 500
self.body = r.reason
else:
# WFIO
self.code = 500
self.body = r
msg.debug('code: %s' % self.code)
示例10: connect
def connect(self, cb=None):
self.stop(False)
self.empty_selects = 0
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.secure:
if ssl:
cert_path = os.path.join(G.COLAB_DIR, 'startssl-ca.pem')
with open(cert_path, 'wb') as cert_fd:
cert_fd.write(cert.CA_CERT.encode('utf-8'))
self.sock = ssl.wrap_socket(self.sock, ca_certs=cert_path, cert_reqs=ssl.CERT_REQUIRED)
else:
msg.log('No SSL module found. Connection will not be encrypted.')
if self.port == G.DEFAULT_PORT:
self.port = 3148 # plaintext port
msg.debug('Connecting to %s:%s' % (self.host, self.port))
try:
self.sock.connect((self.host, self.port))
if self.secure and ssl:
self.sock.do_handshake()
except socket.error as e:
msg.error('Error connecting:', e)
self.reconnect()
return
self.sock.setblocking(0)
msg.debug('Connected!')
self.reconnect_delay = G.INITIAL_RECONNECT_DELAY
self.send_auth()
if cb:
cb()
示例11: maybe_selection_changed
def maybe_selection_changed(self, vim_buf, is_ping):
buf = self.get_buf(vim_buf)
if not buf:
msg.debug("no buffer found for view %s" % vim_buf.number)
return
view = self.get_view(buf["id"])
msg.debug("selection changed: %s %s %s" % (vim_buf.number, buf["id"], view))
self.SELECTION_CHANGED.append([view, is_ping])
示例12: update_view
def update_view(self, buf, view=None):
msg.debug('updating view for buf %s' % buf['id'])
view = view or self.get_view(buf['id'])
if not view:
msg.log('view for buf %s not found. not updating' % buf['id'])
return
self.MODIFIED_EVENTS.put(1)
view.set_text(buf['buf'])
示例13: set_text
def set_text(self, text):
msg.debug("\n\nabout to patch %s %s" % (str(self), self.vim_buf.name))
try:
msg.debug("now buf is loadedish? %s" % vim.eval("bufloaded(%s)" % self.native_id))
self.vim_buf[:] = text.encode("utf-8").split("\n")
except Exception as e:
msg.error("couldn't apply patches because: %s!\nThe unencoded text was: %s" % (str(e), text))
raise
示例14: wrapped
def wrapped(self, data):
if data.get("id") is None:
msg.debug("no buf id in data")
return
buf = self.FLOO_BUFS.get(data["id"])
if buf is None or "buf" not in buf:
msg.debug("buf is not populated yet")
return
func(self, data)
示例15: clear_highlights
def clear_highlights(view):
if not Listener.agent:
return
buf = get_buf(view)
if not buf:
return
msg.debug('clearing highlights in %s, buf id %s' % (buf['path'], buf['id']))
for user_id, username in Listener.agent.room_info['users'].items():
view.erase_regions('floobits-highlight-%s' % user_id)