本文整理汇总了Python中helper.H.data_read方法的典型用法代码示例。如果您正苦于以下问题:Python H.data_read方法的具体用法?Python H.data_read怎么用?Python H.data_read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper.H
的用法示例。
在下文中一共展示了H.data_read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_watch_data
# 需要导入模块: from helper import H [as 别名]
# 或者: from helper.H import data_read [as 别名]
def load_watch_data():
data_path = os.path.join(sublime.packages_path(), 'User', S.FILE_WATCH_DATA)
data = []
try:
data_file = open(data_path, 'rb')
except:
e = sys.exc_info()[1]
info('Failed to open %s.' % data_path)
debug(e)
try:
data = json.loads(H.data_read(data_file.read()))
except:
e = sys.exc_info()[1]
info('Failed to parse %s.' % data_path)
debug(e)
# Check if expression is not already defined
duplicates = []
for index, entry in enumerate(data):
matches = [x for x in S.WATCH if x['expression'] == entry['expression']]
if matches:
duplicates.append(entry)
else:
# Unset any previous value
data[index]['value'] = None
for duplicate in duplicates:
data.remove(duplicate)
if not isinstance(S.WATCH, list):
S.WATCH = []
# Set watch data
S.WATCH.extend(data)
示例2: load_watch_data
# 需要导入模块: from helper import H [as 别名]
# 或者: from helper.H import data_read [as 别名]
def load_watch_data():
data_path = os.path.join(sublime.packages_path(), 'User', S.FILE_WATCH_DATA)
data = []
try:
data_file = open(data_path, 'rb')
except:
e = sys.exc_info()[1]
info('Failed to open %s.' % data_path)
debug(e)
try:
data = json.loads(H.data_read(data_file.read()))
except:
e = sys.exc_info()[1]
info('Failed to parse %s.' % data_path)
debug(e)
# Check if expression is not already defined
for entry in data:
matches = [x for x in S.WATCH if x['expression'] == entry['expression']]
if matches:
data.remove(entry)
if not isinstance(S.WATCH, list):
S.WATCH = []
# Set watch data
S.WATCH.extend(data)
示例3: load_breakpoint_data
# 需要导入模块: from helper import H [as 别名]
# 或者: from helper.H import data_read [as 别名]
def load_breakpoint_data():
data_path = os.path.join(sublime.packages_path(), 'User', S.FILE_BREAKPOINT_DATA)
data = {}
try:
data_file = open(data_path, 'rb')
except:
e = sys.exc_info()[1]
info('Failed to open %s.' % data_path)
debug(e)
try:
data = json.loads(H.data_read(data_file.read()))
except:
e = sys.exc_info()[1]
info('Failed to parse %s.' % data_path)
debug(e)
# Do not use deleted files or entries without breakpoints
if data:
for filename, breakpoint_data in data.copy().items():
if not breakpoint_data or not os.path.isfile(filename):
del data[filename]
if not isinstance(S.BREAKPOINT, dict):
S.BREAKPOINT = {}
# Set breakpoint data
S.BREAKPOINT.update(data)
示例4: read_until_null
# 需要导入模块: from helper import H [as 别名]
# 或者: from helper.H import data_read [as 别名]
def read_until_null(self):
"""
Get response data from debugger engine.
"""
# Check socket connection
if self.connected:
# Get result data from debugger engine
while not '\x00' in self.buffer:
self.buffer += H.data_read(self.socket.recv(self.read_size))
data, self.buffer = self.buffer.split('\x00', 1)
return data
else:
raise ProtocolConnectionException("Xdebug is not connected")
示例5: read_until_null
# 需要导入模块: from helper import H [as 别名]
# 或者: from helper.H import data_read [as 别名]
def read_until_null(self):
"""
Get response data from debugger engine.
"""
# Check socket connection
if self.connected:
# Get result data from debugger engine
try:
while not "\x00" in self.buffer:
self.buffer += H.data_read(self.socket.recv(self.read_size))
data, self.buffer = self.buffer.split("\x00", 1)
return data
except:
e = sys.exc_info()[1]
raise ProtocolConnectionException(e)
else:
raise ProtocolConnectionException("Xdebug is not connected")