Browse Source

minor formatting

master
JoYo 2 years ago
parent
commit
42c7364589
  1. 6
      .gitignore
  2. 2
      sins/orm.py
  3. 3
      sins/run.py

6
.gitignore

@ -1,3 +1,7 @@
__pycache__/
seed
out/
out/
build/
dist/
*.egg-info/
.vscode

2
sins/orm.py

@ -13,12 +13,14 @@ now = '{0:%Y%m%dT%H%M%S}'.format(datetime.utcnow())
Base = declarative_base()
def db_config(path: Path) -> Session:
engine = create_engine(f'sqlite:///{path.resolve()}', native_datetime=True)
Base.metadata.create_all(engine)
session = Session(engine)
return session
class ScrapNode(Base):
__tablename__ = 'scrap_node'
ctime = Column(DateTime, default=datetime.utcnow)

3
sins/run.py

@ -70,7 +70,8 @@ def sins():
logger.info(f'db_path: {db_path}')
if args.seed:
exists = session.query(ScrapNode).filter(ScrapNode.checksum == seed.checksum)
exists = session.query(ScrapNode).filter(
ScrapNode.checksum == seed.checksum)
if exists:
seed = exists[0]

Loading…
Cancel
Save