Skip to content

Commit

Permalink
userland import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Mar 1, 2023
1 parent 9f4bbbc commit f18abbf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion userland/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""xthulu default userland"""
"""Default userland"""
5 changes: 3 additions & 2 deletions userland/cli/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
from inspect import isclass

# local
from xthulu import config, db
from xthulu import db
from xthulu.configuration import get_config


async def seed():
"""Seed userland model data."""

await db.set_bind(config["db"]["bind"])
await db.set_bind(get_config("db.bind"))
models = __import__("userland.models", fromlist=("*",))

for m in dir(models):
Expand Down
2 changes: 1 addition & 1 deletion userland/scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""xthulu default userland scripts"""
"""Default userland scripts"""
6 changes: 3 additions & 3 deletions userland/scripts/lock_example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""xthulu lock example"""
"""Lock example"""

# api
from xthulu.context import Context
from xthulu.ssh.context import SSHContext


async def main(cx: Context):
async def main(cx: SSHContext):
with cx.lock("testing") as l:
if not l:
cx.echo("Unable to acquire lock\r\n")
Expand Down
8 changes: 4 additions & 4 deletions userland/scripts/oneliners.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""oneliners script"""
"""Oneliners script"""

# api
from xthulu.context import Context
from xthulu.ui.editors import LineEditor
from xthulu.ssh.context import SSHContext
from xthulu.ssh.ui.editors import LineEditor

# local
from userland.models import Oneliner
Expand All @@ -14,7 +14,7 @@
"""Number of oneliners to display on screen"""


async def main(cx: Context):
async def main(cx: SSHContext):
async def get_oneliners():
recent = (
Oneliner.select("id")
Expand Down
8 changes: 4 additions & 4 deletions userland/scripts/top.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Userland entry point"""

# local
from xthulu.context import Context
from xthulu.ui import show_art
# api
from xthulu.ssh.context import SSHContext
from xthulu.ssh.ui import show_art


async def main(cx: Context):
async def main(cx: SSHContext):
if cx.encoding == "utf-8":
cx.echo("\x1b%G")
elif cx.env["TERM"] != "ansi":
Expand Down

0 comments on commit f18abbf

Please sign in to comment.