desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'template method.
åœæåè¿æ¥äžtelnetæ§å¶å°æ¶åè°pytickprofile'
| def onConnectedToConsole(self):
| self.consoleInst.write('kbe\r\n')
self.consoleInst.write(((((':' + self.cmd) + ' ') + self.sec) + '\r\n'))
|
'template method.
åœä»telenetæ§å¶å°æ¶å°äºæ°æ°æ®ä»¥ååè°'
| def onReceivedConsoleData(self, data):
| self.wsInst.send(data)
return True
|
'template method.'
| def onReceivedClientData(self, data):
| if (data == ':'):
self.wsInst.close()
return False
self.consoleInst.write(_pre_process_cmd(data))
return True
|
''
| def do(self):
| self.logger.close()
self.logger.connect(self.extaddr, self.extport)
self.logger.registerToLoggerForWeb(self.uid, self.components_check, self.logtype, self.globalOrder, self.groupOrder, self.searchDate, self.keystr)
def onReceivedLog(logs):
new_logs = list((set(logs) ^ set(self.previous_log)))
... |
''
| def close(self):
| self.logger.close()
self.logger.deregisterFromLogger()
if self.wsInst:
self.wsInst.close()
self.wsInst = None
self.extaddr = ''
self.extport = 0
|
''
| def __init__(self):
| print ('MachinesMgr::__init__(), USE_MACHINES_BUFFER = %s' % settings.USE_MACHINES_BUFFER)
if (self.instance is not None):
assert False
self.instance = weakref.proxy(self)
self.machineInst = Machines.Machines(0, 'WebConsole')
self.interfaces_groups = {}
self.machines = []
se... |
''
| def queryAllDatas(self):
| hosts = '<broadcast>'
if (isinstance(settings.MACHINES_ADDRESS, (tuple, list)) and settings.MACHINES_ADDRESS):
hosts = settings.MACHINES_ADDRESS
self.machineInst.queryAllInterfaces(hosts, 0, settings.MACHINES_QUERY_WAIT_TIME)
self.interfaces_groups = self.machineInst.interfaces_groups
self.m... |
''
| def startThread(self):
| self.thread = threading.Thread(None, self.threadRun, 'MachinesDetecter')
self.thread.start()
|
''
| def threadRun(self):
| use_buffer = settings.USE_MACHINES_BUFFER
while (use_buffer and settings.USE_MACHINES_BUFFER and ((time.time() - self.lastQueryTime) < settings.STOP_BUFFER_TIME)):
self.queryAllDatas()
self.inited = True
time.sleep(settings.MACHINES_BUFFER_FLUSH_TIME)
print ('MachinesMgr::threadRun()... |
''
| def checkAndQueryInterfaces(self):
| if settings.USE_MACHINES_BUFFER:
self.lastQueryTime = time.time()
if (not self.inited):
self.startThread()
while (not self.inited):
time.sleep(0.5)
elif ((time.time() - self.lastQueryTime) >= 1.0):
self.queryAllDatas()
self.lastQueryTime = ... |
''
| def filterComponentsForUID(self, uid, interfaces_groups):
| if (uid <= 0):
return interfaces_groups
result = {}
for (k, v) in interfaces_groups.items():
result[k] = [e for e in v if (e.uid == uid)]
return result
|
''
| def queryAllInterfaces(self, uid, user):
| self.checkAndQueryInterfaces()
ig = self.interfaces_groups
return self.filterComponentsForUID(uid, ig)
|
'è·åææmachinesæ°æ®'
| def queryMachines(self):
| self.checkAndQueryInterfaces()
return self.machines
|
'倿æ¯åŠååšç¹å®çmachine(æºåš)'
| def hasMachine(self, machineHost):
| self.checkAndQueryInterfaces()
ms = self.machines
for info in ms:
if (info.intaddr == machineHost):
return True
return False
|
'çæäžäžªçžå¯¹å¯äžçgusïŒéå
šå±å¯äžïŒ'
| def makeGUS(self, componentType):
| return self.machineInst.makeGUS(componentType)
|
'çæçžå¯¹å¯äžçcidïŒéå
šå±å¯äžïŒ'
| def makeCID(self, componentType):
| return self.machineInst.makeCID(componentType)
|
'Receive string data(byte array) from the server.
return value: string(byte array) value.'
| def read(self):
| try:
(_, data) = self.read_data()
return data
except socket.error:
self._abort()
|
'Websocket masking function.
`mask` is a `bytes` object of length 4; `data` is a `bytes` object of any length.
Returns a `bytes` object of the same length as `data` with the mask applied
as specified in section 5.3 of RFC 6455.
This pure-python implementation may be replaced by an optimized version when available.'
| @classmethod
def mask_or_unmask(cls, mask, data):
| mask = array.array('B', mask)
unmasked = array.array('B', data)
for i in range(len(data)):
unmasked[i] = (unmasked[i] ^ mask[(i % 4)])
if hasattr(unmasked, 'tobytes'):
return unmasked.tobytes()
else:
return unmasked.tostring()
|
'Computes the value for the Sec-WebSocket-Accept header,
given the value for Sec-WebSocket-Key.'
| @classmethod
def compute_accept_value(cls, key):
| sha1 = hashlib.sha1()
sha1.update(key)
sha1.update('258EAFA5-E914-47DA-95CA-C5AB0DC85B11')
return base64.b64encode(sha1.digest())
|
'Recieve data with operation code.
return value: tuple of operation code and string(byte array) value.'
| def read_data(self):
| while ((not self.server_terminated) and (not self.client_terminated)):
(fin, opcode, data) = self.read_frame()
if (opcode in (self.OPCODE_TEXT, self.OPCODE_BINARY)):
return (opcode, data)
elif (opcode == self.OPCODE_CLOSE):
self.client_terminated = True
(c... |
'recieve data as frame from server.'
| def read_frame(self):
| header_bytes = self._read_strict(2)
b1 = (header_bytes[0] if six.PY3 else ord(header_bytes[0]))
fin = ((b1 >> 7) & 1)
opcode = (b1 & 15)
b2 = (header_bytes[1] if six.PY3 else ord(header_bytes[1]))
mask = ((b2 >> 7) & 1)
length = (b2 & 127)
length_data = ''
if (length == 126):
... |
'Return ``True`` if new data can be read from the socket.'
| def can_read(self, timeout=0.0):
| (r, w, e) = ([self.sock], [], [])
try:
(r, w, e) = select.select(r, w, e, timeout)
except select.error as err:
if (err.args[0] == EINTR):
return False
self._abort()
return (self.sock in r)
|
'Sends the given message to the client of this Web Socket.'
| def write(self, message, binary=False):
| if binary:
opcode = 2
else:
opcode = 1
self._write_frame(True, opcode, message)
|
'write ping data.
payload: data payload to write server.'
| def write_ping(self, payload=''):
| self._write_frame(True, self.OPCODE_PING, payload)
|
'write pong data.
payload: data payload to write server.'
| def write_pong(self, data):
| self._write_frame(True, self.OPCODE_PONG, data)
|
'write close data to the server.
reason: the reason to close. This must be string.'
| def write_close(self, code=None, reason=None):
| if ((code is None) and (reason is not None)):
code = 1000
if (code is None):
close_data = ''
else:
close_data = struct.pack('>H', code)
if (reason is not None):
close_data += reason
self._write_frame(True, self.OPCODE_CLOSE, close_data)
|
'Instantly _aborts the WebSocket connection by closing the socket'
| def _abort(self):
| self.server_terminated = True
self.client_terminated = True
self.sock.close()
|
'Arguments:
- ``socket``: An open socket that should be used for WebSocket
communciation.
- ``protocol``: not used yet.
- ``version``: The WebSocket spec version to follow (default is 76)
- ``handshake_reply``: Handshake message that should be sent to the
client when ``send_handshake()`` is called.
- ``handshake_sent``... | def __init__(self, protocol):
| self.protocol = protocol
self.closed = False
self._message_queue = collections.deque()
|
'Send a message to the client. *message* should be convertable to a
string; unicode objects should be encodable as utf-8.'
| def send(self, message):
| if (not self.closed):
self.protocol.write(message)
|
'Returns the number of queued messages.'
| def count_messages(self):
| self._get_new_messages()
return len(self._message_queue)
|
'Returns ``True`` if new messages from the socket are available, else
``False``.'
| def has_messages(self):
| if self._message_queue:
return True
self._get_new_messages()
if self._message_queue:
return True
return False
|
'Return new message or ``fallback`` if no message is available.'
| def read(self, fallback=None):
| if self.has_messages():
return self._message_queue.popleft()
return fallback
|
'Waits for and deserializes messages. Returns a single message; the
oldest not yet processed.'
| def wait(self):
| while (not self._message_queue):
if self.closed:
return None
new_data = self.protocol.read()
if (not new_data):
return None
self._message_queue.append(new_data)
return self._message_queue.popleft()
|
'Forcibly close the websocket.'
| def close(self, code=None, reason=None):
| if (not self.closed):
self.protocol.close(code, reason)
self.closed = True
|
'check the websocket'
| def is_websocket(self):
| if (self.request.META.get('HTTP_UPGRADE', '').lower() == 'websocket'):
return True
else:
return False
|
'Send a message to the client. *message* should be convertable to a
string; unicode objects should be encodable as utf-8.'
| def send(self, message):
| raise NotImplementedError
|
'Returns the number of queued messages.'
| def count_messages(self):
| raise NotImplementedError
|
'Returns ``True`` if new messages from the socket are available, else
``False``.'
| def has_messages(self):
| raise NotImplementedError
|
'Return new message or ``fallback`` if no message is available.'
| def read(self, fallback=None):
| raise NotImplementedError
|
'Waits for and deserializes messages. Returns a single message; the
oldest not yet processed.'
| def wait(self):
| raise NotImplementedError
|
'Use ``WebSocket`` as iterator. Iteration only stops when the websocket
gets closed by the client.'
| def __iter__(self):
| while True:
message = self.wait()
(yield message)
if (message is None):
break
|
'Forcibly close the websocket.'
| def close(self, code=None, reason=None):
| raise NotImplementedError
|
'Èç¹ûWorkbookÒÑŸŽò¿ªÐèÒªÏȹرպóŽò¿ª
forcedClose£ºÊÇ·ñÇ¿ÖÆ¹Ø±Õ£¬ºóŽò¿ªžÃWorkbook'
| def getWorkbook(self, forcedClose=False):
| try:
wn = len(self.__xapp.Workbooks)
except:
print '\xb3\xcc\xd0\xf2\xd2\xec\xb3\xa3\xcd\xcb\xb3\xf6\xa3\xac\xd5\xe2\xbf\xc9\xc4\xdc\xca\xc7\xc4\xe3\xb4\xf2\xbf\xaa\xb1\xe0\xbc\xad\xc1\xcb"\xc4\xb3\xce\xc4\xbc\xfe"\xb6\xf8\xc3\xbb\xd3\xd0\xb1\xa3\xb4\xe6\xb8\xc3\xce\xc4\xbc\xfe\xd4\xec\xb3\xc9\x... |
'¹Ø±ÕexcelÓŠÓÃ'
| def close(self, saveChanges=False):
| if self.__xapp:
self.__xlsx.Close(SaveChanges=saveChanges)
if (len(self.__xapp.Workbooks) == 0):
self.__xapp.Quit()
else:
return False
|
''
| def getSheetCount(self):
| return self.__xlsx.Sheets.Count
|
'»ñµÃexcelÉÏÖž¶šË÷ÒýλÖÃÉϵıíÃû³Æ'
| def getSheetNameByIndex(self, index):
| return self.getSheetByIndex(index).Name
|
'»ñµÃexcelÉÏÖž¶šË÷ÒýλÖÃÉϵıí'
| def getSheetByIndex(self, index):
| if (index in range(1, (len(self.__xlsx.Sheets) + 1))):
return self.__xlsx.Sheets(index)
else:
return None
|
''
| def getRowCount(self, sheetIndex):
| return self.getSheetByIndex(sheetIndex).Cells(1).CurrentRegion.Columns.Count
|
''
| def getColCount(self, sheetIndex):
| return self.getSheetByIndex(sheetIndex).Cells(1).CurrentRegion.Rows.Count
|
''
| def getValue(self, sheet, row, col):
| return sheet.Cells(row, col).Value
|
''
| def getText(self, sheet, row, col):
| return sheet.Cells(row, col).Text
|
''
| def getRowValues(self, sheet, row):
| return sheet.Cells(1).CurrentRegion.Rows[row].Value[0]
|
''
| def getSheetRowIters(self, sheet, row):
| return sheet.Cells(1).CurrentRegion.Rows
|
''
| def getSheetColIters(self, sheet, col):
| return sheet.Cells(1).CurrentRegion.Columns
|
''
| def getColValues(self, sheet, col):
| return sheet.Cells(1).CurrentRegion.Columns[col].Value
|
'pyfile:py, sourcefile:source excel, excel:dest excel'
| def __init__(self, pyfile, sourcefile, dstfile):
| self.pyfile = os.path.abspath(pyfile)
if (sourcefile == ''):
self.sourcefile = sourcefile
else:
self.sourcefile = os.path.abspath(sourcefile)
self.dstfile = os.path.abspath(dstfile)
self.xlsx = None
self.xbook = None
self.sheetCNames = {}
self.sheetENames = {}
self.ma... |
'import self.pyfile as python module'
| def importPyModule(self):
| self.pyModule = None
try:
sys.path.append(PY_MODULE_PATH)
except NameError:
pass
(pyPath, filename) = os.path.split(self.pyfile)
pypos = filename.strip().rfind('.py')
if (pypos < 0):
print 'pypypypypypypypy'
else:
filename = filename[:pypos]
sys.path.appen... |
''
| def readXlsxHeader(self):
| if (self.xlsx is None):
print 'no file opened'
self.names = {}
for (si, sn) in self.sheetCNames.iteritems():
sheet = Sheet(self.xbook, si)
self.names[sn] = {}
tmpEInt = 1
tmpCInt = 1
for (engStruct, chnName) in zip(sheet.getRowValues((EXPORT_DEFINE_ROW -... |
'pyçåå
žåå
¥å°xlsx'
| def writeNewXlsx(self):
| def getWorkbook():
(dirs, filename) = os.path.split(self.dstfile)
if (not os.path.isdir(dirs)):
os.makedirs(dirs)
return ExcelTool(self.dstfile)
if (self.xbook is not None):
self.xbook.close()
self.xbook = None
self.xbook = getWorkbook()
if os.path.isf... |
'åå°å¯Œåºxlsxç第äžè¡'
| def writeXlsxHeader(self, headerCNames):
| for (pos, cn) in enumerate(headerCNames):
self.newSheet.Cells(1, (pos + 1)).Value = cn
|
'åå
žçæ°æ®åå
¥å°exceläž'
| def writeData2Cells(self, data, headerKeys):
| if (self.newSheet is None):
return
for (vp, v) in enumerate(data.itervalues()):
for (p, he) in enumerate(headerKeys):
text = self.convertType(v.get(he, ''))
self.newSheet.Cells((vp + 2), (p + 1)).Value = text
return
|
'ä»workbookéåæèŠåå
¥æ°æ®çsheet'
| def getWriteSheet(self, cname):
| if (cname in self.repeatUse):
newSheet = self.xbook.getSheetByIndex(self.repeatUse.pop(cname))
elif (len(self.useless) > 0):
newSheet = self.xbook.getSheetByIndex(self.useless.pop((-1)))
newSheet.Name = cname
else:
newSheet = self.xbook.getXLSX().Sheets.Add()
newSheet... |
''
| def parseWriteSheet(self, cnames):
| self.repeatUse = {}
self.useless = []
for index in range(1, (self.xbook.getSheetCount() + 1)):
name = self.xbook.getSheetNameByIndex(index)
if (name in cnames):
self.repeatUse[name] = index
else:
self.useless.append(index)
return
|
''
| def convertType(self, val):
| if isinstance(val, str):
return val.decode('utf-8')
elif isinstance(val, (dict, list, tuple)):
return xlsxtool.value_to_text(val)
return val
|
'ÊäÈëO(other)µÄ»Øµ÷
¹Ø±ÕÒÑŽò¿ªµÄexcel£¬È»ºóÖØÐÂŽò¿ª'
| def resetXlsx(self):
| self.xbook.getWorkbook(forcedClose=True)
|
''
| def run(self):
| self.__initXlsx()
self.__initInfo()
self.openFile()
self.sth4Nth()
self.constructMapDict()
self.__onRun()
|
'something for nothing, Žú¶Ô±íºÍµŒÈë±íÐèÒªÓÐ'
| def sth4Nth(self):
| for index in range(1, (self.xbook.getSheetCount() + 1)):
sheetName = self.xbook.getSheetNameByIndex(index)
if (sheetName == EXPORT_MAP_SHEET):
self.__onFindMapSheet(index)
if sheetName.startswith(EXPORT_PREFIX_CHAR):
self.__onFindExportSheet(index)
self.onSth4Nth(... |
''
| def onSth4Nth(self):
| if (not hasattr(self, 'mapIndex')):
self.xlsxClear(EXPORT_ERROR_NOMAP)
if (len(self.__exportSheetIndex) == 0):
xlsxError.error_input(EXPORT_ERROR_NOSHEET)
return
|
''
| def __onFindExportSheet(self, Eindex):
| self.__exportSheetIndex.append(Eindex)
|
''
| def constructMapDict(self):
| mapDict = {}
sheet = self.xbook.getSheetByIndex(self.mapIndex)
if (not sheet):
return
for col in range(0, self.xbook.getRowCount(self.mapIndex)):
colValues = self.xbook.getColValues(sheet, col)
if colValues:
for v in [e for e in colValues[1:] if (e[0] and isinstance(e... |
''
| def __onConstruct(self, mapDict):
| self.mapDict = mapDict
return
|
'µÚÒ»ÐеĞöÔªËØÊÇ·ñ·ûºÏ¶šÒåžñÊœ"name[signs][func]"ÒÔŒ°keyÊÇ·ñ·ûºÏ¹æ¶š'
| def __checkDefine(self):
| print '\xbc\xec\xb2\xe2\xce\xc4\xbc\xfe\xcd\xb7(\xb5\xda\xd2\xbb\xd0\xd0)\xca\xc7\xb7\xf1\xd5\xfd\xc8\xb7'
for index in self.__exportSheetIndex:
self.sheetKeys = []
headList = self.xbook.getRowValues(self.xbook.getSheetByIndex(index), (EXPORT_DEFINE_ROW - 1))
enName = []
reTuples... |
''
| def __checkData(self):
| self.sheetIndex2Data()
self.dctDatas = g_dctDatas
self.hasExportedSheet = []
for (dataName, indexList) in self.sheet2Data.items():
self.curIndexMax = len(indexList)
self.curProIndex = []
for index in indexList:
sheet = self.xbook.getSheetByIndex(index)
sel... |
''
| def needReplace(self, cellData):
| v = cellData['v'].strip()
if isinstance(v, float):
v = str(int(v))
if (v not in self.mapDict):
self.xlsxClear(EXPORT_ERROR_NOTMAP, (cellData['pos'], v))
|
''
| def exportSheet(self):
| self.__onExportSheet()
return
|
'ÊýŸÝת³ÉpyÎÄŒþ'
| def __onExportSheet(self):
| self.writeXLSX2PY()
return
|
''
| def openFile(self):
| dirPath = os.path.split(self.outfile)[0]
if (not os.path.isdir(dirPath)):
try:
xlsxtool.createDir(dirPath)
except:
self.xlsxClear(EXPORT_ERROR_CPATH, (dirPath,))
try:
fileHandler = codecs.open(self.outfile, 'w+', 'utf-8')
except:
self.xlsxClear(EXP... |
'pyÎÄŒþŽò¿ªÁË,¿ÉÒÔÐŽÎÄŒþÁË'
| def __onOpenFile(self, fileHandler):
| self.fileName = self.outfile
self.fileHandler = fileHandler
del self.outfile
|
'ÐŽÈëdataÎÄŒþ'
| def xlsxWrite(self, stream):
| if (not hasattr(self, 'fileHandler')):
self.xlsxClear(EXPORT_ERROR_FILEOPEN, ())
try:
self.fileHandler.write(stream)
except Exception as errstr:
self.xlsxClear(EXPORT_ERROR_IOOP, errstr)
|
''
| def writeXLSX2PY(self):
| self.writeBody()
return
|
''
| def writeFoot(self):
| if (len(self.hasExportedSheet) < len(self.__exportSheetIndex)):
return
allDataDefs = self.mapDict.get('allDataDefs', '')
if (len(allDataDefs) > 0):
func = getFunc(allDataDefs)
allDataDefs = func(self.dctData)
if ('allDataDefs' in g_fdatas):
g_fdatas['allDataDefs']... |
''
| def xlsxClose(self):
| if hasattr(self, 'fileHandler'):
self.fileHandler.close()
self.xbook.close()
return
|
'³ÌÐòÒì³£Í˳öÇåÀíŽò¿ªµÄExcel'
| def xlsxClear(self, errno=0, msg=''):
| self.xlsxClose()
if (errno > 0):
raise xlsxError.xe(errno, msg)
else:
sys.exit(1)
|
''
| def xlsxbyebye(self):
| self.xlsxClose()
return
|
'Go to the location of the first blank on the given line,
returning the index of the last non-blank character.'
| def _end_of_line(self, y):
| last = self.maxx
while True:
if (curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP):
last = min(self.maxx, (last + 1))
break
elif (last == 0):
break
last = (last - 1)
return last
|
'Process a single editing command.'
| def do_command(self, ch):
| (y, x) = self.win.getyx()
self.lastcmd = ch
if curses.ascii.isprint(ch):
if ((y < self.maxy) or (x < self.maxx)):
self._insert_printable_char(ch)
elif (ch == curses.ascii.SOH):
self.win.move(y, 0)
elif (ch in (curses.ascii.STX, curses.KEY_LEFT, curses.ascii.BS, curses.KEY... |
'Collect and return the contents of the window.'
| def gather(self):
| result = ''
for y in range((self.maxy + 1)):
self.win.move(y, 0)
stop = self._end_of_line(y)
if ((stop == 0) and self.stripspaces):
continue
for x in range((self.maxx + 1)):
if (self.stripspaces and (x > stop)):
break
result = (... |
'Edit in the widget window and collect the results.'
| def edit(self, validate=None):
| while 1:
ch = self.win.getch()
if validate:
ch = validate(ch)
if (not ch):
continue
if (not self.do_command(ch)):
break
self.win.refresh()
return self.gather()
|
'Run the module after setting up the environment.
First check the syntax. If OK, make sure the shell is active and
then transfer the arguments, set the run environment\'s working
directory to the directory of the module being executed and also
add that directory to its sys.path if not already included.'
| def _run_module_event(self, event):
| filename = self.getfilename()
if (not filename):
return 'break'
code = self.checksyntax(filename)
if (not code):
return 'break'
if (not self.tabnanny(filename)):
return 'break'
interp = self.shell.interp
if PyShell.use_subprocess:
interp.restart_subprocess(wit... |
'Get source filename. If not saved, offer to save (or create) file
The debugger requires a source file. Make sure there is one, and that
the current version of the source buffer has been saved. If the user
declines to save or cancels the Save As dialog, return None.
If the user has configured IDLE for Autosave, the ... | def getfilename(self):
| filename = self.editwin.io.filename
if (not self.editwin.get_saved()):
autosave = idleConf.GetOption('main', 'General', 'autosave', type='bool')
if (autosave and filename):
self.editwin.io.save(None)
else:
confirm = self.ask_save_dialog()
self.editwin.... |
'Load PyShellEditorWindow breakpoints into subprocess debugger'
| def load_breakpoints(self):
| for editwin in self.pyshell.flist.inversedict:
filename = editwin.io.filename
try:
for lineno in editwin.breakpoints:
self.set_breakpoint_here(filename, lineno)
except AttributeError:
continue
|
'override base method'
| def popup_event(self, event):
| if self.stack:
return ScrolledList.popup_event(self, event)
|
'override base method'
| def fill_menu(self):
| menu = self.menu
menu.add_command(label='Go to source line', command=self.goto_source_line)
menu.add_command(label='Show stack frame', command=self.show_stack_frame)
|
'override base method'
| def on_select(self, index):
| if (0 <= index < len(self.stack)):
self.gui.show_frame(self.stack[index])
|
'override base method'
| def on_double(self, index):
| self.show_source(index)
|
'Create a Unicode string.'
| def _decode(self, two_lines, bytes):
| chars = None
if bytes.startswith(BOM_UTF8):
try:
chars = bytes[3:].decode('utf-8')
except UnicodeDecodeError:
return (None, False)
else:
self.fileencoding = 'BOM'
return (chars, False)
try:
enc = coding_spec(two_lines)
excep... |
'Update recent file list on all editor windows'
| def updaterecentfileslist(self, filename):
| if self.editwin.flist:
self.editwin.update_recent_files_list(filename)
|
'Replace the current word with the next expansion.'
| def expand_word_event(self, event):
| curinsert = self.text.index('insert')
curline = self.text.get('insert linestart', 'insert lineend')
if (not self.state):
words = self.getwords()
index = 0
else:
(words, index, insert, line) = self.state
if ((insert != curinsert) or (line != curline)):
wo... |
'Return a list of words that match the prefix before the cursor.'
| def getwords(self):
| word = self.getprevword()
if (not word):
return []
before = self.text.get('1.0', 'insert wordstart')
wbefore = re.findall((('\\b' + word) + '\\w+\\b'), before)
del before
after = self.text.get('insert wordend', 'end')
wafter = re.findall((('\\b' + word) + '\\w+\\b'), after)
... |
'Return the word prefix before the cursor.'
| def getprevword(self):
| line = self.text.get('insert linestart', 'insert')
i = len(line)
while ((i > 0) and (line[(i - 1)] in self.wordchars)):
i = (i - 1)
return line[i:]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.