def startUp(test): '''Startup function with a test flag This creates the sqlite connection as well as clearing the sign and re-creating it from what is in the sqlite db''' global sqlite sqlite = sqlite() sqlite.setup() clearMemoryConfig() time.sleep(.1) updateSign() if test: app.debug = True app.run() else: app.run(host='0.0.0.0', threaded=True)
def __init__(self, parent = None, pathBD = None): FILENAME = 'seleccionar_campos.ui' QtGui.QDialog.__init__(self) uifile = os.path.join(os.path.abspath(os.path.dirname(__file__)),FILENAME) uic.loadUi(uifile, self) self.center() self.__bd = sqlite(pathBD) self.__camposSeleccionados = [] self.__camposActuales = [] self.papa = parent self.lbUbicacion.setText(pathBD) self.__cargarTablas() self.lwCamposElegidos = MyTableWidget(self.lstCamposElegidos, ['Campo', 'Widget'])
def __init__(self): """ コンストラクタ """ self.cyclecount = 0 # 受信作成 self.sub_client = rospy.Subscriber('sql', sql, self.insertCallback, queue_size=1) # messageのインスタンスを作る self.msg_sql = sql() # dbを作成する db_name = 'TEST' self.db = sqlite.sqlite(db_name) print("db create by sampleDB")
def __init__(self, parent=None, pathBD=None): FILENAME = 'seleccionar_campos.ui' QtGui.QDialog.__init__(self) uifile = os.path.join(os.path.abspath(os.path.dirname(__file__)), FILENAME) uic.loadUi(uifile, self) self.center() self.__bd = sqlite(pathBD) self.__camposSeleccionados = [] self.__camposActuales = [] self.papa = parent self.lbUbicacion.setText(pathBD) self.__cargarTablas() self.lwCamposElegidos = MyTableWidget(self.lstCamposElegidos, ['Campo', 'Widget'])
def parsePage(self, url): webpageBytes = urllib.request.urlopen(url).read() gbkCharset = re.compile('charset\s*=\s*(gb2312|gbk)',re.IGNORECASE) mGbk = re.search(gbkCharset, str(webpageBytes)) if mGbk is not None: webpage = webpageBytes.decode('gbk','ignore') else: utf8Charset = re.compile('charset\s*=\s*utf-8',re.IGNORECASE) mUtf8 = re.search(utf8Charset, str(webpageBytes)) if mUtf8 is not None: webpage = webpageBytes.decode('utf-8','ignore') else: webpage = webpageBytes.decode('gbk','ignore') #=============================================================================== # webpage = re.sub(r"\\'", r"'", webpage) # webpage = re.sub(r'\\[rn]', r' ', webpage) #=============================================================================== webpage = re.sub('\s+',' ', webpage) doubleQuotation = re.compile(r'("[^=><"]*)"([^=><"]*)"([^=><"]*")') oldList = doubleQuotation.findall(webpage) for oldItem in oldList: webpage = webpage.replace(oldItem[0]+'"'+oldItem[1]+'"'+oldItem[2], oldItem[0]+"'"+oldItem[1]+"'"+oldItem[2]) tp = myParser(self.divClass) tp.feed(webpage) newlink = '' for newlink in tp.getlinklist(): noFollow = 0 for nf in self.nofollowList: if newlink.find(nf) != -1: noFollow = 1 if noFollow: continue if str.find(str.lower(newlink), 'mailto:') != -1: continue #other domain if newlink[:7] == 'http://' and newlink.find(self.domainName) == -1: continue #some links like 'www.xxx.com', then the final link would be 'http://www.abc.com/www.xxx.com, error! if newlink[:7] != 'http://' and newlink[0] != '/': continue if newlink[:4] != 'http' and newlink.find('://') == -1: newlink = 'http://'+self.domainName+newlink if newlink not in self.linkQueue and newlink not in self.linkDone: self.linkQueue.append(newlink) print(newlink) if len(tp.getcontent()) == 0: fNothing = open('../nocontent.log','a+') fNothing.write(url+'\n') print("nothing!") return None sqlitehandle = sqlite.sqlite() sqlitehandle.insertContent(url, tp.gettitle(), tp.getcontent() ) #=============================================================================== # f = open('../content.txt', 'a+') # f.write(url+'\n') # f.write(tp.gettitle()+'\n') # f.write(tp.getcontent()+'\n\n') #=============================================================================== print(tp.gettitle()) print(tp.getcontent())
def get_db(): return sqlite().dbfile(get_db_file_path())
def __init__(self): self.db = sqlite.sqlite()
def __init__(self,rutaBD): u''' Costructor de la clase. ''' self.__pathBD = rutaBD self.__Busqueda = Busqueda() self.bd = sqlite.sqlite(self.__pathBD)
import lunareport import prescan import sqlite import conf.lunaconf import lunaargvs import lunalog import sys import time luna_conf = conf.lunaconf.lunaconf() luna_log = lunalog.lunalog(luna_conf.log_file) luna_output = output.output() luna_prescan = prescan.prescan() luna_exp = lunaexploit.lunaexploit() luna_sqlite = sqlite.sqlite() luna_file = lunafile.filecontroller(luna_conf.http_log) luna_argvs = lunaargvs.lunaargvs() luna_exploit = lunaexploit.lunaexploit() def luna(): luna_argvs.handle_argvs() if luna_argvs.newsqlite == True: luna_sqlite.create() if len(luna_argvs.flush_session_host) != 0: luna_sqlite.flush_session_cgi(luna_argvs.flush_session_host)
Keys = ['name', 'languages'] Columns = ['Region', 'City Name', 'Languaje', 'Time'] Table = [] if 'Point1Class' in globals() and 'Point2and3Class' in globals(): RegionsOfPoint1 = Point1Class._FindDiferentKeys( 'region', Point1Class.GetAPIRequest()) for City in RegionsOfPoint1: tic = time.time() Output = Point2and3Class.OutputToChoose(Input=City, KeyInput='region', KeysOutput=Keys, Subindex='name') toc = (time.time() - tic) * 1000 Table.append([City] + Output + [toc]) DataBase = sqlite() dfTable = pd.DataFrame(data=Table, columns=Columns) display(dfTable) TotalTime = dfTable['Time'].sum() MeanTime = dfTable['Time'].mean() MinTime = dfTable['Time'].min() MaxTime = dfTable['Time'].max() DataBase.IFCreateTable() DataBase.InsertFromTable(SumTime=str(TotalTime), MeanTime=str(MeanTime), MinTime=str(MinTime), MaxTime=str(MaxTime)) JsonPath = os.getcwd() + '\data.json' dfTable.to_json(JsonPath) print('The total time to build this table is:' + str(TotalTime))