本文整理汇总了Python中msg.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'])
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:7,代码来源:emacs_protocol.py
示例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'])
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:7,代码来源:emacs_protocol.py
示例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)
开发者ID:nilbus,项目名称:sublime-text-2-plugin,代码行数:7,代码来源:agent_connection.py
示例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)
开发者ID:rdgmatos,项目名称:dot,代码行数:7,代码来源:vim_protocol.py
示例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)
开发者ID:Web5design,项目名称:plugin-common-python,代码行数:33,代码来源:ignore.py
示例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)
开发者ID:nkabir,项目名称:floobits-vim,代码行数:7,代码来源:agent_connection.py
示例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
开发者ID:Floobits,项目名称:floobits-emacs,代码行数:28,代码来源:repo.py
示例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"])
开发者ID:rdgmatos,项目名称:dot,代码行数:25,代码来源:protocol.py
示例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)
开发者ID:Floobits,项目名称:floobits-sublime,代码行数:26,代码来源:api.py
示例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()
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:29,代码来源:agent_connection.py
示例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])
开发者ID:rdgmatos,项目名称:dot,代码行数:8,代码来源:vim_protocol.py
示例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'])
开发者ID:nkabir,项目名称:floobits-vim,代码行数:8,代码来源:vim_protocol.py
示例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
开发者ID:rdgmatos,项目名称:dot,代码行数:8,代码来源:vim_protocol.py
示例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)
开发者ID:rdgmatos,项目名称:dot,代码行数:9,代码来源:protocol.py
示例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)
开发者ID:rosshadden,项目名称:floobits-sublime,代码行数:9,代码来源:listener.py
示例16: emacs_handle
def emacs_handle(self, data):
msg.debug(data)
name = data.get('name')
if not name:
return msg.error('no name in data?!?')
func = getattr(self, "on_emacs_%s" % (name))
if not func:
return msg.debug('unknown name', name, 'data:', data)
func(data)
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:9,代码来源:emacs_protocol.py
示例17: is_shared
def is_shared(self, p):
if not self.agent.is_ready():
msg.debug('agent is not ready. %s is not shared' % p)
return False
p = utils.unfuck_path(p)
# TODO: tokenize on path seps and then look for ..
if utils.to_rel_path(p).find("../") == 0:
return False
return True
开发者ID:awesome,项目名称:floobits-vim,代码行数:9,代码来源:protocol.py
示例18: on_selection_modified
def on_selection_modified(self, view, buf=None):
try:
SELECTED_EVENTS.get_nowait()
except queue.Empty:
buf = buf or get_buf(view)
if buf:
msg.debug('selection in view %s, buf id %s' % (buf['path'], buf['id']))
self.selection_changed.append((view, buf, False))
else:
SELECTED_EVENTS.task_done()
开发者ID:rosshadden,项目名称:floobits-sublime,代码行数:10,代码来源:listener.py
示例19: _offset_to_vim
def _offset_to_vim(self, offset):
current_offset = 0
for line_num, line in enumerate(self.vim_buf):
next_offset = len(line) + 1
if current_offset + next_offset > offset:
break
current_offset += next_offset
col = offset - current_offset
msg.debug("offset %s is line %s column %s" % (offset, line_num + 1, col + 1))
return line_num + 1, col + 1
开发者ID:rdgmatos,项目名称:dot,代码行数:10,代码来源:vim_protocol.py
示例20: __init__
def __init__(self, parent, path):
self.parent = parent
self.ignores = {}
self.path = utils.unfuck_path(path)
msg.debug('Initializing ignores for %s' % path)
for ignore_file in IGNORE_FILES:
try:
self.load(ignore_file)
except:
pass
开发者ID:Wilfred,项目名称:floobits-emacs,代码行数:10,代码来源:ignore.py
注:本文中的msg.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论