rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.endpointDecoders = {0: self.controlDecoder}
self.endpointDecoders = {}
def __init__(self, decoderFactory): self.decoderFactory = decoderFactory self.currentConfig = 1
data = ''.join(tokens[5:10])
data = ''.join(tokens[5:7]) data = ''.join((data, tokens[7][2:4], tokens[7][0:2])) data = ''.join((data, tokens[8][2:4], tokens[8][0:2])) data = ''.join((data, tokens[9][2:4], tokens[9][0:2]))
def parse(self, line, timestamp=None): self.lineNumber += 1 tokens = line.split() try: # Do a small stupid sanity check if this is a correct usbmon log line try: if len(tokens) < 4: return if not(int(tokens[0],16) and int(tokens[1]) and (tokens[2] in ('S', 'C', 'E'))): return except: print "Error on line %d:" % self.li...
self.progressCallbacks = []
def __init__(self, filename, parser, progressQueue=None, tailMode=False): self.filename = filename self.parser = parser self.progressQueue = progressQueue
if line[10] != "T": """XXX: This assumes the current year, so logs that straddle years will have a giant discontinuity in timestamps. """ timefmt = "%b %d %H:%M:%S" stamp = line[:15] usec = line[16:19] else: timefmt = "%Y-%m-%dT%H:%M:%S" stamp = line[:19] usec = line[20:23]
def parseTime(self, line): """Return a unix-style timestamp for the given line. XXX: This assumes the current year, so logs that straddle years will have a giant discontinuity in timestamps. """ # Cache the results of strptime. It only changes every # second, and this was taking more than 50% of our parsing time! stamp...
stamp = line[:15]
def parseTime(self, line): """Return a unix-style timestamp for the given line. XXX: This assumes the current year, so logs that straddle years will have a giant discontinuity in timestamps. """ # Cache the results of strptime. It only changes every # second, and this was taking more than 50% of our parsing time! stamp...
parsed = time.strptime(stamp, "%b %d %H:%M:%S")
parsed = time.strptime(stamp, timefmt)
def parseTime(self, line): """Return a unix-style timestamp for the given line. XXX: This assumes the current year, so logs that straddle years will have a giant discontinuity in timestamps. """ # Cache the results of strptime. It only changes every # second, and this was taking more than 50% of our parsing time! stamp...
usec = int(line[16:19])
usec = int(usec)
def parseTime(self, line): """Return a unix-style timestamp for the given line. XXX: This assumes the current year, so logs that straddle years will have a giant discontinuity in timestamps. """ # Cache the results of strptime. It only changes every # second, and this was taking more than 50% of our parsing time! stamp...
elif len(tokens) >= 2 and len(tokens[0]) == 4 and len(tokens[1]) == 2:
elif (len(tokens) >= 2 and len(tokens[0]) >= 4 and tokens[0][-1] == ':' and len(tokens[1]) == 2):
def parse(self, line, timestamp=None, frame=None, lineNumber=None): tokens = line.split() finished = None
self.endpointDecoders = {0: self.controlDecoder}
def _cacheEndpointDecoders(self): """Update the endpointDecoders dictionary using the current configuration and interface settings. """ self.endpointDecoders = {0: self.controlDecoder}
if decoder:
if decoder and address not in self.endpointDecoders:
def _cacheEndpointDecoders(self): """Update the endpointDecoders dictionary using the current configuration and interface settings. """ self.endpointDecoders = {0: self.controlDecoder}
return version.getTrailingLabel()
return cookLabel
def getTargetLabel(self, versionOrLabel): if isinstance(versionOrLabel, versions.Label): cookLabel = versionOrLabel elif isinstance(versionOrLabel, versions.Branch): cookLabel = versionOrLabel.label() else: cookLabel = versionOrLabel.trailingLabel()
'ignoreAllRebuildDeps', 'primaryTroves' ]
'ignoreAllRebuildDeps', 'primaryTroves', 'reposName', ]
def __thaw__(class_, d): """ Support the thaw mechanism to allow a build config to be read from xmlrpc. Converts back from a set of strings. """ obj = class_() for name, cfgItem in obj._options.iteritems(): if name in d: lines = d[name] if not lines and obj[name] is None: obj[name] = lines
self.log('Worker node %s diconnected' % sessionId)
self.log('Worker node %s disconnected' % sessionId)
def nodeDisconnected(self, sessionId): """ Entry point from messagebus client to alert dispatcher that a node disconnected. """ if sessionId in self._nodes: self.log('Worker node %s diconnected' % sessionId) self._nodes.remove(sessionId) self._assignQueuedCommands()
self.hostname = os.uname()[2]
self.hostname = os.uname()[1]
def __init__(self): self.hostname = os.uname()[2] self.cpus = getCpuInfo() self.update()
repo.remove(files, unlink=True)
wlock = repo.wlock() try: for name in files: os.unlink(name) repo.dirstate.remove(name) finally: wlock.release()
def generate(repo): version = _getVersion() old = codecs.open('NEWS','r','utf8').read() if '@NEW@' in old: sys.exit("error: NEWS contains a @NEW@ section") elif ('Changes in %s:' % version) in old: sys.exit("error: NEWS already contains a %s section" % version) lines, htmlLines, files = preview(repo, modifiedOK=False)...
buildJob.troveFailed(failureReason)
buildJob.jobFailed(failureReason)
def commandErrored(self, commandInfo, failureReason): if hasattr(commandInfo, 'getTrove'): buildTrove = commandInfo.getTrove() buildTrove.own() buildTrove.troveFailed(failureReason) elif hasattr(commandInfo, 'getJob'): buildJob = commandInfo.getJob() buildJob.own() buildJob.troveFailed(failureReason)
return admin.getAdminClient(self.cfg.messageBusHost,
return admin.getAdminClient(self.cfg.getMessageBusHost(),
def getAdminClient(self): return admin.getAdminClient(self.cfg.messageBusHost, self.cfg.messageBusPort)
def _update_message_state(self, event):
def _update_message_state(self, event = None):
def _update_message_state(self, event): if not self._have_message: self._set_initial_message_state() return if self._rxbag: self._message_status_text.SetLabel("Receiving rxbag messages") self._message_status_text.SetForegroundColour(color_dict[0]) self._tree_ctrl.SetBackgroundColour(wx.WHITE) self._error_tree_ctrl.SetB...
self._tree_ctrl.DeleteAllItems()
self._tree_ctrl.DeleteChildren(self._tree_ctrl.GetRootItem()) self._error_tree_ctrl.DeleteChildren(self._error_tree_ctrl.GetRootItem()) self._warning_tree_ctrl.DeleteChildren(self._warning_tree_ctrl.GetRootItem())
def reset_monitor(self): # Reset tree control if self._have_message: self._tree_ctrl.DeleteAllItems() self._state.reset() self._is_stale = True
if not self._empty_id: self._empty_id = self._tree_ctrl.AppendItem(self._tree_ctrl.GetRootItem(), "No data") self._tree_ctrl.SetItemImage(self._empty_id, self._image_dict[3])
def reset_monitor(self): # Reset tree control if self._have_message: self._tree_ctrl.DeleteAllItems() self._state.reset() self._is_stale = True
self._empty_id = self._tree_ctrl.AppendItem(self._tree_ctrl.GetRootItem(), "No data") self._tree_ctrl.SetItemImage(self._empty_id, self._image_dict[3])
def reset_monitor(self): # Reset tree control if self._have_message: self._tree_ctrl.DeleteAllItems() self._state.reset() self._is_stale = True
self._text_ctrl.Clear()
self._text_ctrl.SetCaretPosition(0)
def _write_status(self, status): self._text_ctrl.Freeze() self._text_ctrl.Clear() self._text_ctrl.SetBasicStyle(self._basic_style) self._text_ctrl.SetDefaultStyle(self._default_style) self._set_kv("Full name", status.name) self._set_kv("Component", status.name.split('/')[-1]) self._set_kv("Hardware ID", status.hardware...
self._text_ctrl.EndAllStyles()
self._text_ctrl.EndAllStyles() self._text_ctrl.Remove(self._text_ctrl.GetCaretPosition(), self._text_ctrl.GetLastPosition())
def _write_status(self, status): self._text_ctrl.Freeze() self._text_ctrl.Clear() self._text_ctrl.SetBasicStyle(self._basic_style) self._text_ctrl.SetDefaultStyle(self._default_style) self._set_kv("Full name", status.name) self._set_kv("Component", status.name.split('/')[-1]) self._set_kv("Hardware ID", status.hardware...
self._text_ctrl.SetCaretPosition(0)
has_caret_accessors = getattr(self._text_ctrl, 'SetCaretPosition') if (has_caret_accessors): self._text_ctrl.SetCaretPosition(0) else: self._text_ctrl.Clear()
def _write_status(self, status): self._text_ctrl.Freeze() self._text_ctrl.SetCaretPosition(0) self._text_ctrl.SetBasicStyle(self._basic_style) self._text_ctrl.SetDefaultStyle(self._default_style) self._set_kv("Full name", status.name) self._set_kv("Component", status.name.split('/')[-1]) self._set_kv("Hardware ID", s...
self._text_ctrl.Remove(self._text_ctrl.GetCaretPosition(), self._text_ctrl.GetLastPosition())
if (has_caret_accessors): self._text_ctrl.Remove(self._text_ctrl.GetCaretPosition(), self._text_ctrl.GetLastPosition())
def _write_status(self, status): self._text_ctrl.Freeze() self._text_ctrl.SetCaretPosition(0) self._text_ctrl.SetBasicStyle(self._basic_style) self._text_ctrl.SetDefaultStyle(self._default_style) self._set_kv("Full name", status.name) self._set_kv("Component", status.name.split('/')[-1]) self._set_kv("Hardware ID", s...
has_caret_accessors = getattr(self._text_ctrl, 'SetCaretPosition')
has_caret_accessors = True try: getattr(self._text_ctrl, 'SetCaretPosition') except: has_caret_accessors = False
def _write_status(self, status): self._text_ctrl.Freeze() # SetCaretPosition and GetCaretPosition was only added to wxPython in 2.8.10 apparently, even though they've been in wx for ages has_caret_accessors = getattr(self._text_ctrl, 'SetCaretPosition') if (has_caret_accessors): self._text_ctrl.SetCaretPosition(0) els...
wx.CallAfter(self.new_message)
wx.CallAfter(self.new_message, rospy.get_rostime())
def diagnostics_callback(self, message): self._mutex.acquire() self._messages.append(message) self._mutex.release() wx.CallAfter(self.new_message)
self.update_item(item, new_status, was_selected)
self.update_item(item, new_status, was_selected, item.stamp)
def on_timer(self, event): for name, item in self._name_to_item.iteritems(): id = item.tree_id if (item != None): if (not item.mark): was_selected = False if (self._tree_control.GetSelection() == id): was_selected = True new_status = copy.deepcopy(item.status) new_status.level = -1 self.update_item(item, new_status, w...
" def check(" + formals + ") throws Exception {",
" def check(" + formals + ") {",
" def check(" + formals + ") throws Exception {",
" def check(" + formals + ") throws Exception = " + exp + ";"
" def check(" + formals + ") = " + exp + ";"
" def check(" + formals + ") throws Exception = " + exp + ";"
prelude = readLines(f, "%~~vis", True, False, basename)
global currentLine prelude = ( ["// file " + basename + " line " + str(currentLine) + "\n"] + readLines(f, "%~~vis", True, False, basename) )
def doGen(cmd, args, f, line, basename): #print("doGen: " + cmd + " on " + "!".join(args)); prelude = readLines(f, "%~~vis", True, False, basename) body = readLines(f, "%~~siv", False, True, basename) postlude = readLines(f, "%~~neg", True, False, basename) classname = numberedName(basename) if len(args) >= 1: classnam...
return u'Extreme Management'
return self.site_title
def _get_project_title(self): project = self._get_project() if project is not None and project.title != '': return project.title else: return u'Extreme Management'
return MessageContainer('No Results','No video file could be found for teh following query: '+query)
return MessageContainer('No Results','No video file could be found for the following query: '+query)
def ParseSearchResults(sender, query=None): dir = MediaContainer(viewGroup="InfoList") results = XML.ElementFromURL('http://www.khanacademy.org/search?page_search_query='+query,True).xpath("//section[@class='videos']//dt/a") if results == []: return MessageContainer('No Results','No video file could be found for teh...
VideoItem.thumb = R(ICON)
def Start(): Plugin.AddPrefixHandler(VIDEO_PREFIX, VideoMainMenu, L('Title'), ICON, ART) Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items") Plugin.AddViewGroup("List", viewMode="List", mediaType="items") MediaContainer.art = R(ART) MediaContainer.title1 = NAME DirectoryItem.thumb = R(ICON) HTTP...
dir.Append(Function(DirectoryItem(ByCategory,"Browse By Category...",thumb=R(ICON),art=R(ART)))) dir.Append(Function(DirectoryItem(AllCategories,"All Categories",thumb=R(ICON),art=R(ART)))) dir.Append(Function(InputDirectoryItem(ParseSearchResults,"Search ...","Search",thumb=R("search.png"),art=R(ART))))
dir.Append(Function(DirectoryItem(ByCategory,"Browse By Category..."))) dir.Append(Function(DirectoryItem(AllCategories,"All Categories"))) dir.Append(Function(InputDirectoryItem(ParseSearchResults,"Search ...","Search",thumb=R("icon-search.png"))))
def VideoMainMenu(): dir = MediaContainer(viewGroup="List") dir.Append(Function(DirectoryItem(ByCategory,"Browse By Category...",thumb=R(ICON),art=R(ART)))) dir.Append(Function(DirectoryItem(AllCategories,"All Categories",thumb=R(ICON),art=R(ART)))) dir.Append(Function(InputDirectoryItem(ParseSearchResults,"Search .....
dir.Append(Function(DirectoryItem(Submenu, el.text, thumb=R(ICON), art=R(ART)), category = String.Unquote(el.get('href').replace('
dir.Append(Function(DirectoryItem(Submenu, el.text), category = String.Unquote(el.get('href').replace('
def ByCategory(sender, Menu = None ): dir = MediaContainer(viewGroup="List") if Menu == None: Menu = HTML.ElementFromURL('http://www.khanacademy.org/').xpath("//ul[@class='menu']")[0] else: Menu = HTML.ElementFromString(Menu) queue = deque([Menu]) el = queue.popleft() queue.extend(el) while queue: el = queue.popleft...
dir.Append(Function(DirectoryItem(Submenu, el.text, thumb=R(ICON), art=R(ART)), category = String.Unquote(el.get('href')),TestPrep = True))
dir.Append(Function(DirectoryItem(Submenu, el.text), category = String.Unquote(el.get('href')),TestPrep = True))
def ByCategory(sender, Menu = None ): dir = MediaContainer(viewGroup="List") if Menu == None: Menu = HTML.ElementFromURL('http://www.khanacademy.org/').xpath("//ul[@class='menu']")[0] else: Menu = HTML.ElementFromString(Menu) queue = deque([Menu]) el = queue.popleft() queue.extend(el) while queue: el = queue.popleft...
dir.Append(Function(DirectoryItem(ByCategory, el.text, thumb=R(ICON), art=R(ART)), Menu = str(serialized)))
dir.Append(Function(DirectoryItem(ByCategory, el.text), Menu = str(serialized)))
def ByCategory(sender, Menu = None ): dir = MediaContainer(viewGroup="List") if Menu == None: Menu = HTML.ElementFromURL('http://www.khanacademy.org/').xpath("//ul[@class='menu']")[0] else: Menu = HTML.ElementFromString(Menu) queue = deque([Menu]) el = queue.popleft() queue.extend(el) while queue: el = queue.popleft...
Categories = HTML.ElementFromURL('http://www.khanacademy.org/').xpath("//h2[@class='playlist-heading']") for cat in Categories: dir.Append(Function(DirectoryItem(Submenu,cat.text,thumb=R(ICON),art=R(ART)),category = cat.text))
for cat in HTML.ElementFromURL('http://www.khanacademy.org/').xpath("//h2[@class='playlist-heading']"): dir.Append(Function(DirectoryItem(Submenu,cat.text),category = cat.text))
def AllCategories(sender ): dir = MediaContainer(viewGroup="List") Categories = HTML.ElementFromURL('http://www.khanacademy.org/').xpath("//h2[@class='playlist-heading']") for cat in Categories: dir.Append(Function(DirectoryItem(Submenu,cat.text,thumb=R(ICON),art=R(ART)),category = cat.text)) return dir
dir.Append(Function(VideoItem(PlayVideo,video.text,thumb=R(ICON),art=R(ART)),link = video.get("href")))
dir.Append(Function(VideoItem(PlayVideo,video.text),link = video.get("href")))
def ParseSearchResults(sender, query=None): dir = MediaContainer(viewGroup="InfoList") results = HTML.ElementFromURL('http://www.khanacademy.org/search?page_search_query='+query).xpath("//section[@class='videos']//dt/a") if results == []: return MessageContainer('No Results','No video file could be found for the fol...
dir.Append(Function(VideoItem(PlayVideo,video.text,thumb=R(ICON),art=R(ART)),link = video.get("href")))
dir.Append(Function(VideoItem(PlayVideo,video.text),link = video.get("href")))
def Submenu(sender, category, TestPrep = False): dir = MediaContainer(viewGroup="List") if TestPrep == False : html = HTTP.Request('http://www.khanacademy.org/').content.replace('></A>','>').replace('<div class="clear"></div>','</A>') videolist = HTML.ElementFromString(html).xpath("//a[@name='"+category+"']/ol//a") el...
def GetYouTubeVideo(video_id): yt_page = HTTP.Request(YT_VIDEO_PAGE % (video_id), cacheTime=1).content
fmt_url_map = re.findall('"fmt_url_map".+?"([^"]+)', yt_page)[0] fmt_url_map = fmt_url_map.replace('\/', '/').split(',')
def GetYouTubeVideo(video_id): yt_page = HTTP.Request(YT_VIDEO_PAGE % (video_id), cacheTime=1).content t = re.findall('&t=([^&]+)', yt_page)[0] fmt_list = re.findall('&fmt_list=([^&]+)', yt_page)[0] fmt_list = String.Unquote(fmt_list, usePlus=False) fmts = re.findall('([0-9]+)[^,]*', fmt_list) index = YT_VIDEO_FORMAT...
t = re.findall('&t=([^&]+)', yt_page)[0] fmt_list = re.findall('&fmt_list=([^&]+)', yt_page)[0] fmt_list = String.Unquote(fmt_list, usePlus=False) fmts = re.findall('([0-9]+)[^,]*', fmt_list)
fmts = [] fmts_info = {}
def GetYouTubeVideo(video_id): yt_page = HTTP.Request(YT_VIDEO_PAGE % (video_id), cacheTime=1).content t = re.findall('&t=([^&]+)', yt_page)[0] fmt_list = re.findall('&fmt_list=([^&]+)', yt_page)[0] fmt_list = String.Unquote(fmt_list, usePlus=False) fmts = re.findall('([0-9]+)[^,]*', fmt_list) index = YT_VIDEO_FORMAT...
index = YT_VIDEO_FORMATS.index( Prefs.Get('ytfmt') ) if YT_FMT[index] in fmts: fmt = YT_FMT[index]
for f in fmt_url_map: (fmt, url) = f.split('|') fmts.append(fmt) fmts_info[str(fmt)] = url index = YOUTUBE_VIDEO_FORMATS.index(Prefs['youtube_fmt']) if YOUTUBE_FMT[index] in fmts: fmt = YOUTUBE_FMT[index]
def GetYouTubeVideo(video_id): yt_page = HTTP.Request(YT_VIDEO_PAGE % (video_id), cacheTime=1).content t = re.findall('&t=([^&]+)', yt_page)[0] fmt_list = re.findall('&fmt_list=([^&]+)', yt_page)[0] fmt_list = String.Unquote(fmt_list, usePlus=False) fmts = re.findall('([0-9]+)[^,]*', fmt_list) index = YT_VIDEO_FORMAT...
if str(YT_FMT[i]) in fmts: fmt = YT_FMT[i]
if str(YOUTUBE_FMT[i]) in fmts: fmt = YOUTUBE_FMT[i]
def GetYouTubeVideo(video_id): yt_page = HTTP.Request(YT_VIDEO_PAGE % (video_id), cacheTime=1).content t = re.findall('&t=([^&]+)', yt_page)[0] fmt_list = re.findall('&fmt_list=([^&]+)', yt_page)[0] fmt_list = String.Unquote(fmt_list, usePlus=False) fmts = re.findall('([0-9]+)[^,]*', fmt_list) index = YT_VIDEO_FORMAT...
url = YT_GET_VIDEO_URL % (video_id, t, fmt) return url
url = fmts_info[str(fmt)] return Redirect(url)
def GetYouTubeVideo(video_id): yt_page = HTTP.Request(YT_VIDEO_PAGE % (video_id), cacheTime=1).content t = re.findall('&t=([^&]+)', yt_page)[0] fmt_list = re.findall('&fmt_list=([^&]+)', yt_page)[0] fmt_list = String.Unquote(fmt_list, usePlus=False) fmts = re.findall('([0-9]+)[^,]*', fmt_list) index = YT_VIDEO_FORMAT...
gc, True, screen_coord[0], screen_coord[1], 20, 20, 0, 360*64
gc, True, screen_coord[0] - radius, screen_coord[1] - radius, radius * 2, radius * 2, 0, 360*64
def draw_circle(self, screen_coord, gc): self.window.draw_arc( gc, True, screen_coord[0], screen_coord[1], 20, 20, 0, 360*64 )
strTemp = (self.entry_custom_path.get_text().lower()).strip() if strTemp != "" and strTemp != "none": if strTemp != (conf.init_path.lower()).strip():
if( os.pathsep == ';' ): newPath = (self.entry_custom_path.get_text().lower()).strip() oldPath = conf.init_path.lower().strip() else: newPath = (self.entry_custom_path.get_text()).strip() oldPath = conf.init_path.strip() if newPath != "" and newPath != "none": if newPath != oldPath:
def btn_save_clicked(button): conf.init_center = ((self.s_center00.get_value_as_int()), (self.s_center01.get_value_as_int())), \ ((self.s_center10.get_value_as_int()), (self.s_center11.get_value_as_int()))
parent.repaint()
parent.drawing_area.repaint()
def btn_save_clicked(self, button, strInfo, filePath, listStore, parent): self.__write_file(strInfo, filePath, listStore) parent.marker.refresh() parent.repaint()
return cloudMade.get_url(self.mt_counter, coord, cloudMade_styleID)
return cloudMade.get_url(self.mt_counter, coord, conf.cloudMade_styleID)
def get_url_from_coord(self, coord, layer, conf): self.mt_counter += 1 self.mt_counter = self.mt_counter % NR_MTS print try: if not conf.oneDirPerMap: if conf.map_service == MAP_SERVERS[VIRTUAL_EARTH] and (layer != LAYER_TERRAIN): return virtualEarth.get_url(self.mt_counter, coord, layer) elif conf.map_service == MAP_S...
screen_coord = self.coord_to_screen(coord[0], coord[1], zl)
screen_coord = self.coord_to_screen(location[0], location[1], zl)
def draw_overlay(self, zl, conf, crossPixbuf, dlpixbuf, downloading=False, visual_dlconfig = {}, marker=None, locations={}, entry_name="", showMarkers=False, gps=None, gps_direction=False): self.set_scale_gc() self.set_visualdl_gc() rect = self.get_allocation() middle = (rect.width / 2, rect.height / 2) full = (rect.wi...
marker.append_marker((Coord[0], Coord[1], zoom), strName)
marker.append_marker((Coord[1], Coord[0], zoom), strName)
def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc
upattern = 'http://mt[0-9].google.com/vt/lyrs\\\\x3d(t@[0-9]+,r@[0-9]+)'
upattern = 'http://mt[0-9].google.com/vt/lyrs=(t@[0-9]+,r@[0-9]+)'
def parse_start_page(layer, html, language): # first, we check the uniform url pattern. # after Oct. 10, 2009, google use a uniform url: # # http://mt%d.google.com/vt/lyrs=??@110&hl=en&x=%i&y=%i&z=%i # # to fetch map, satellite and terrain tiles, where # ?? is 'm' for map, 's' for satellite and 't' for terrain. # googl...
mapServ='Google', styleID =1):
mapServ='Google', styleID=1, language=LANGUAGES[0]):
def get_tile(self, coord, layer, online, force_update, mapServ='Google', styleID =1): return self.tile_repository.get_tile( coord, layer, online, force_update, mapServ, styleID )
coord, layer, online, force_update, mapServ, styleID
coord, layer, online, force_update, mapServ, styleID, language
def get_tile(self, coord, layer, online, force_update, mapServ='Google', styleID =1): return self.tile_repository.get_tile( coord, layer, online, force_update, mapServ, styleID )
return cloudMade.get_url(self.mt_counter, coord, styleID)
return cloudMade.get_url(self.mt_counter, coord, conf.cloudMade_styleID)
def get_url_from_coord(self, coord, layer, conf): self.mt_counter += 1 self.mt_counter = self.mt_counter % NR_MTS # do I really need this empty line? I commented it out. (standa31415) #print try: if not conf.oneDirPerMap: if conf.map_service == MAP_SERVERS[VIRTUAL_EARTH] and (layer != LAYER_TERRAIN): return virtualEart...
self.do_zoom(value)
self.do_zoom(int(round(value)))
def scale_change_value(self, therange, scroll, value): self.do_zoom(value)
self.draw_image(location, img, GPS_IMG_SIZE[0], GPS_IMG_SIZE[1])
self.draw_image( self.coord_to_screen(location[0], location[1], zl), img, GPS_IMG_SIZE[0], GPS_IMG_SIZE[1])
def draw_overlay(self, zl, conf, crossPixbuf, dlpixbuf, downloading=False, visual_dlconfig = {}, marker=None, locations={}, entry_name="", showMarkers=False, gps=None): self.set_scale_gc() self.set_visualdl_gc() rect = self.get_allocation() middle = (rect.width / 2, rect.height / 2) full = (rect.width, rect.height)
self.match_func = read_config('match_func', 'startswith', str)
self.match_func = read_config('match_func', ENTRY_SUB_MENU[0], str)
def read_config(keyOption, defaultValue, castFunction): try: strValue = config.get(SECTION_INIT, keyOption) return castFunction(strValue) except Exception: return defaultValue
if conf.map_service == MAP_SERVERS[OSM] and (layer == LAYER_MAP):
if conf.map_service == MAP_SERVERS[VIRTUAL_EARTH] and (layer != LAYER_TERRAIN): return virtualEarth.get_url(self.mt_counter, coord, layer) elif conf.map_service == MAP_SERVERS[OSM] and (layer == LAYER_MAP):
def get_url_from_coord(self, coord, layer, conf): self.mt_counter += 1 self.mt_counter = self.mt_counter % NR_MTS print try: if not conf.oneDirPerMap: if conf.map_service == MAP_SERVERS[OSM] and (layer == LAYER_MAP): return openStreetMaps.get_url(self.mt_counter, coord) elif conf.map_service == MAP_SERVERS[CLOUDMADE] a...
return googleMapMaker.get_url(self.mt_counter, coord) elif conf.map_service == MAP_SERVERS[VIRTUAL_EARTH] and (layer != LAYER_TERRAIN): return virtualEarth.get_url(self.mt_counter, coord, layer)
return googleMapMaker.get_url(self.mt_counter, coord)
def get_url_from_coord(self, coord, layer, conf): self.mt_counter += 1 self.mt_counter = self.mt_counter % NR_MTS print try: if not conf.oneDirPerMap: if conf.map_service == MAP_SERVERS[OSM] and (layer == LAYER_MAP): return openStreetMaps.get_url(self.mt_counter, coord) elif conf.map_service == MAP_SERVERS[CLOUDMADE] a...
return googleMaps.get_url(self.mt_counter, coord, layer)
return googleMaps.get_url(self.mt_counter, coord, layer, conf.language)
def get_url_from_coord(self, coord, layer, conf): self.mt_counter += 1 self.mt_counter = self.mt_counter % NR_MTS print try: if not conf.oneDirPerMap: if conf.map_service == MAP_SERVERS[OSM] and (layer == LAYER_MAP): return openStreetMaps.get_url(self.mt_counter, coord) elif conf.map_service == MAP_SERVERS[CLOUDMADE] a...
args.lng_range = mapUtils.km_to_lat(args.width, args.lat)
args.lng_range = km_to_lon(args.width, args.lat)
def download(lat, lng, lat_range, lng_range, max_zl, min_zl, layer): for zl in range(max_zl, min_zl - 1, -1): print "Downloading zl %d" % zl downloader.query_region_around_location( lat, lng, lat_range*2, lng_range*2, zl, layer, do_nothing, conf=mConf ) downloader.wait_all()
args.lat_range = mapUtils.km_to_lon(args.height)
args.lat_range = km_to_lat(args.height)
def download(lat, lng, lat_range, lng_range, max_zl, min_zl, layer): for zl in range(max_zl, min_zl - 1, -1): print "Downloading zl %d" % zl downloader.query_region_around_location( lat, lng, lat_range*2, lng_range*2, zl, layer, do_nothing, conf=mConf ) downloader.wait_all()
log.debug("Starting SQLite3Thread")
log.debug("Starting SQLite3Thread with url '%s'" % (str(url), ) )
def __init__(self, url): log.debug("Starting SQLite3Thread")
if not self.sql_thread.isAlive():
if self.sql_thread.isAlive():
def restart_thread(self, url):
print self.key_down
def key_release_event(self, w, event): print self.key_down self.key_down = None
map_server_query = {"gmap":"", "ghyb":"h", "gsat":"h", "gter":"p"} layers_name = {"gmap":"m", "ghyb": "h", "gsat":"s", "gter":"t"}
map_server_query = {"gmap":"m", "ghyb":"h", "gsat":"k", "gter":"p"} layers_name = {"gmap":"m", "ghyb":"h", "gsat":"s", "gter":"t"}
def layer_url_template(layer, language): if layer not in known_layers: map_server_query = {"gmap":"", "ghyb":"h", "gsat":"h", "gter":"p"} layers_name = {"gmap":"m", "ghyb": "h", "gsat":"s", "gter":"t"} oa = openanything.fetch( 'http://maps.google.com/maps?t=' + map_server_query[ MAP_SERVICES[layer]["TextID"] ]) if o...
m = re.match('.*(-\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename)
m = re.match('.*\D(-\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename)
def get_coord_from_name(filename): m = re.match('.*(-\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename) if not m: m = re.match('.*(\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename) if m: g = m.groups() if len(g) == 5: return int(g[1])*1024 + int(g[2]), \ int(g[3])*1024 + int(g[4]), \ int(g[0])
m = re.match('.*(\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename)
m = re.match('.*\D(\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename)
def get_coord_from_name(filename): m = re.match('.*(-\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename) if not m: m = re.match('.*(\d+)\D(\d+)\D(\d+)\D(\d+)\D(\d+)\.png',filename) if m: g = m.groups() if len(g) == 5: return int(g[1])*1024 + int(g[2]), \ int(g[3])*1024 + int(g[4]), \ int(g[0])
except Exception as excInst:
except Exception, excInst:
def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc
self.update_rate = update_rate
self.update_rate = float(update_rate)
def __init__(self, gps_callback, update_rate, gps_mode): global available # GPS Disabled at start self.mode = gps_mode self.location = None self.gps_callback = gps_callback self.pixbuf = self.get_marker_pixbuf() self.update_rate = update_rate
if 'sz' == 1:
if sz == 1:
def draw_image(imgPos, img, width, height): mct = mapUtils.coord_to_tile((imgPos[0], imgPos[1], zl)) xy = mapUtils.tile_coord_to_screen( (mct[0][0], mct[0][1], zl), rect, self.center ) if xy: for x,y in xy: self.window.draw_pixbuf( self.style.black_gc, img, 0, 0, x + mct[1][0] - width/2, y + mct[1][1] - height/2, width...
if layer != 't': upattern = 'http://mt[0-9].google.com/vt/lyrs\\\\x3dm@([0-9]+)'
if layer == 't': upattern = 'http://mt[0-9].google.com/vt/lyrs\\\\x3d(t@[0-9]+,r@[0-9]+)'
def parse_start_page(layer, html, language): # first, we check the uniform url pattern. # after Oct. 10, 2009, google use a uniform url: # # http://mt%d.google.com/vt/lyrs=??@110&hl=en&x=%i&y=%i&z=%i # # to fetch map, satellite and terrain tiles, where # ?? is 'm' for map, 's' for satellite and 't' for terrain. # googl...
layer_str = layer + '@' + m.group(1)
layer_str = m.group(1)
def parse_start_page(layer, html, language): # first, we check the uniform url pattern. # after Oct. 10, 2009, google use a uniform url: # # http://mt%d.google.com/vt/lyrs=??@110&hl=en&x=%i&y=%i&z=%i # # to fetch map, satellite and terrain tiles, where # ?? is 'm' for map, 's' for satellite and 't' for terrain. # googl...
center_offset = (self.center[1][0] + (self.draging_start[0] - x), self.center[1][1] + (self.draging_start[1] - y)) self.center = mapUtils.tile_adjustEx(zoom, self.center[0], center_offset)
offset = (self.center[1][0] + (self.draging_start[0] - x), self.center[1][1] + (self.draging_start[1] - y)) self.center = mapUtils.tile_adjustEx(zoom, self.center[0], offset)
def da_move(self, x, y, zoom): rect = self.get_allocation() if (0 <= x <= rect.width) and (0 <= y <= rect.height): center_offset = (self.center[1][0] + (self.draging_start[0] - x), self.center[1][1] + (self.draging_start[1] - y)) self.center = mapUtils.tile_adjustEx(zoom, self.center[0], center_offset) self.draging_sta...
if zl <= mpos[2] and (mpos[0], mpos[1] != coord[0], coord[1]):
if zl <= mpos[2] and (mpos[0],mpos[1]) != (coord[0],coord[1]):
def draw_image(imgPos, img, width, height): mct = mapUtils.coord_to_tile((imgPos[0], imgPos[1], zl)) xy = mapUtils.tile_coord_to_screen( (mct[0][0], mct[0][1], zl), rect, self.center ) if xy: for x,y in xy: self.window.draw_pixbuf( self.style.black_gc, img, 0, 0, x + mct[1][0] - width/2, y + mct[1][1] - height/2, width...
self.s_center00.set_value(parent.center[0][0]) self.s_center01.set_value(parent.center[0][1]) self.s_center10.set_value(parent.center[1][0]) self.s_center11.set_value(parent.center[1][1]) self.s_zoom.set_value(parent.current_zoom_level)
self.s_center00.set_value(parent.drawing_area.center[0][0]) self.s_center01.set_value(parent.drawing_area.center[0][1]) self.s_center10.set_value(parent.drawing_area.center[1][0]) self.s_center11.set_value(parent.drawing_area.center[1][1]) self.s_zoom.set_value(parent.get_zoom())
def btn_use_current(button, parent): self.s_center00.set_value(parent.center[0][0]) self.s_center01.set_value(parent.center[0][1]) self.s_center10.set_value(parent.center[1][0]) self.s_center11.set_value(parent.center[1][1]) self.s_zoom.set_value(parent.current_zoom_level) dsize = parent.window.get_size() self.s_width....
self.configpath = self.mapServ_inst.configpath
def __init__(self, MapServ_inst): self.tile_cache = lrucache.LRUCache(1000) self.mapServ_inst = MapServ_inst self.lock = Lock() self.configpath = self.mapServ_inst.configpath
path = os.path.join(self.configpath, LAYER_DIRS[layer])
path = os.path.join(self.mapServ_inst.configpath, LAYER_DIRS[layer])
def coord_to_path(self, tile_coord, layer): self.lock.acquire() path = os.path.join(self.configpath, LAYER_DIRS[layer]) path = fileUtils.check_dir(path) path = fileUtils.check_dir(path, '%d' % tile_coord[2]) path = fileUtils.check_dir(path, "%d" % (tile_coord[0] / 1024)) path = fileUtils.check_dir(path, "%d" % (tile_co...
self.configpath = self.mapServ_inst.configpath
self.configpath = MapServ_inst.configpath
def __init__(self, MapServ_inst): self.configpath = self.mapServ_inst.configpath self.tile_cache = lrucache.LRUCache(1000) self.mapServ_inst = MapServ_inst self.lock = Lock() self.missingPixbuf = mapPixbuf.missing()
MAP_SERVICES[layer]["layerDir"] + "_" + str(tile_coord[2]),
"YahooMap_" + str(MAP_MAX_ZOOM_LEVEL - tile_coord[2]), self.calc_v2_hash(tile_coord[0], tile_coord[1]),
def coord_to_path(self, tile_coord, layer): return os.path.join( self.configpath, MAP_SERVICES[layer]["layerDir"] + "_" + str(tile_coord[2]), str(tile_coord[0]) + "_" + str(tile_coord[1]) + ".mgm" )
location, coord = googleMaps.search_location(location)
location, coord = search_location(location)
def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc
print respdata
def report(refname, merged): "Generare a commit notification to be reported to CIA" # Try to tinyfy a reference to a web view for this commit. try: postdata = serialize({"method": "add_url", 'params': ["%s%s" %(urlprefix, merged) ], 'id':'ciabot.py'}) respdata = urllib.urlopen("http://deb.li/rpc/json", postdata).read(...
postdata = serialize({"method": "add_url", 'params': ["%s%s" %(urlprefix, merged) ], 'id':'ciab
postdata = serialize({"method": "add_url", 'params': ["%s%s" %(urlprefix, merged) ], 'id':'ciabot.py'})
def report(refname, merged): "Generate a commit notification to be reported to CIA" # Try to tinyfy a reference to a web view for this commit. try: postdata = serialize({"method": "add_url", 'params': ["%s%s" %(urlprefix, merged) ], 'id':'ciab respdata = urllib.urlopen("http://deb.li/rpc/json", postdata).read() resp =...
TSK_FS_ATTR_TYPE_NTFS_DATA
TSK_FS_ATTR_TYPE_NTFS_DATA, TSK_FS_ATTR_TYPE_DEFAULT,
def error(string): print string sys.exit(1)
out.write("\nerror:\n %s;\n" % self.error_condition()) out.write("};\n\n")
out.write("\nerror:\n PyGILState_Release(gstate);\n %s;\n" % self.error_condition()) out.write(" };\n};\n")
def _write_definition(self, out): out.write("{\nPyObject *py_result;\n") out.write('PyObject *method_name = PyString_FromString("%s");\n' % self.name) out.write(self.return_type.definition())
log( "Parent: Opening") segment1 = zip.open_member("hello", "w", 0) log( "Parent: Starting write")
try: log( "Parent: Opening") segment1 = zip.open_member("hello", "w", 0) log( "Parent: Starting write") finally: zip.cache_return()
def a(): log( "parent started") zip = oracle.open(zip_urn, 'w') log( "Parent: Opening") segment1 = zip.open_member("hello", "w", 0) log( "Parent: Starting write") time.sleep(2) segment1.write("hello") segment1.close() log( "Parent: Ended write") zip.close()
log( "Child: Opening") segment2 = zip.open_member("world", "w", 0) log( "Child: Starting write") time.sleep(1)
try: log( "Child: Opening") segment2 = zip.open_member("world", "w", 0) log( "Child: Starting write") finally: zip.cache_return() time.sleep(3)
def b(): zip = oracle.open(zip_urn, 'w') log( "Child: Opening") segment2 = zip.open_member("world", "w", 0) log( "Child: Starting write") time.sleep(1) segment2.write("hello") segment2.close() log( "Child: Ended write") zip.close()
print "%s,%s,%s " % (block * self.blocksize, file_block * self.blocksize, hashed_urn.value)
def dump_block(self): ## Read all the data into a single string data_blocks = []
print
def dump_block(self): ## Read all the data into a single string data_blocks = []
print self.workers
def dump_block_run(self, blocks, size): """ Dump the block run given as a reverse map """
shlink_flags = self['LINKFLAGS'].split()
shlink_flags = self['LINKFLAGS'].split() + ['-Llib/']
def PythonModule(self, libname, lib_objs=[], **kwargs): """ This builds a python module which is almost a library but is sometimes named differently.
m = hashlib.md5()
m = hashlib.sha1()
def dump_blocks(self): ## Read all the data into a single string data_blocks = []
MAX_THREADS = 5
MIN_SIZE = 64 MAX_THREADS = 2
def add_block_run(self, hashed_urn): image_stream = oracle.open(self.image_stream_urn, 'w') available = 0 try: #log("Acquired %s" % self.image_stream_urn.value) blocks = self.blocks + [-1] last_image_block = -10
image.set_data_type(pyaff4.AFF4_MAP_TEXT)
def __init__(self, in_urn, output_urn, *args, **kwargs): self.in_urn = in_urn
def dump_blocks(self, blocks, filename):
def dump_blocks(self, blocks, filename=None):
def dump_blocks(self, blocks, filename): i = 0 while 1: ## Split the file into smaller runs if len(blocks) - i > self.MAX_SIZE: run = blocks[i:i+self.MAX_SIZE] self.dump_block_run(run, inode = filename) i += self.MAX_SIZE else: run = blocks[i:] self.dump_block_run(run, inode = filename) break
if not blocks: continue stat = fs.fstat(skfs) if stat.st_size < self.blocksize: continue if stat.st_size > (len(blocks)+1)*self.blocksize: continue log("Dumping %s %s (%s bytes)" % (f, filename, stat.st_size)) size = stat.st_size self.dump_blocks(blocks, filename)
if len(blocks) > self.MIN_SIZE: log("Dumping %s %s (%s bytes)" % (f, filename, len(blocks) * self.blocksize)) self.dump_blocks(blocks, filename)
def dump_filesystem(self): """ This method analyses the filesystem and dumps all the files in it based on hashes. """ ## FIXME - handle partitions here self.fd.seek(0) fs = sk.skfs(self.fd) self.blocksize = fs.block_size
log( "Dumping unallocated from %s to %s" % (offset, offset+available)) blocks = [ x for x in range(offset / self.blocksize, (offset + available) / self.blocksize) ] self.dump_blocks(blocks, "unallocated@%s" % offset)
log( "Dumping unallocated from %s to %s (%s bytes)" % ( offset, offset+available, available)) blocks += [ x for x in range(offset / self.blocksize, (offset + available) / self.blocksize) ] if len(blocks) >= self.MAX_SIZE: self.dump_blocks(blocks[:self.MAX_SIZE]) blocks = blocks[self.MAX_SIZE:]
def dump_unallocated(self): offset = 0 while 1: image_stream = oracle.open(self.image_urn, 'w') try: urn, target_offset, available, target_id = image_stream.map.get_range(offset) finally: image_stream.cache_return()
image_fd.urn.set(zip_fd.urn.value)
image_fd.urn.set(zip_urn.value)
def image(output_URI, options, fds): """ Copy the file like objects specified in the fds list into an output volume specified by its URI. """ out_fd = oracle.open(output_URI, 'w') ## A file urn was specified if isinstance(out_fd, pyaff4.FileLikeObject): out_fd.cache_return() ## Make a volume object zip_fd = oracle.cre...