Skip to content

Instantly share code, notes, and snippets.

def txt_split(s):
import re
indx_srch = '<[a-z0-9 ]+>'
txt_frags = re.split(indx_srch, s)
indx_lst = re.findall(indx_srch,s)
ret=[]
ret.extend(re.split(' +', txt_frags[0]))
for i,indx in enumerate( indx_lst):
if ret[-1]=='':
@valq7711
valq7711 / recursive_select.py
Last active November 28, 2019 20:16
pyDAL recursive select
# fake table in which result of recursive select will be temporary stored
# id-values will be inherited from parent_child table
db.define_table('entry_collector',
Field('child', 'integer'),
Field('xpath', 'json'), # array of ids, xpath[0] == root, xpath[-1] == child
Field('root', 'integer'),
Field('xdepth', 'integer'),
migrate_enabled = False,
fake_migrate = True
)
@valq7711
valq7711 / async_pydal.py
Created June 1, 2021 20:25
async_pydal
from pydal import DAL
from voodoodal import DB, Table, Field, model
import aiosqlite
import asyncio
# async sqlexecuter
class SQLExecuter:
def __init__(self, pydal_adapter, adb_executer):
self.adb_executer = adb_executer
self.adapter = pydal_adapter