Skip to content

Commit

Permalink
clean up imports and routers
Browse files Browse the repository at this point in the history
  • Loading branch information
nsheff committed Oct 17, 2023
1 parent 79edcd4 commit ba655de
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 44 deletions.
2 changes: 1 addition & 1 deletion bedhost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logmuse

from bedhost.const import PKG_NAME
from .const import PKG_NAME

_LOGGER = logmuse.init_logger(PKG_NAME)
Empty file removed bedhost/dependencies.py
Empty file.
4 changes: 2 additions & 2 deletions bedhost/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

from bbconf import BedBaseConf
from fastapi.staticfiles import StaticFiles
from starlette.responses import FileResponse, RedirectResponse
from typing import List, Union
from urllib import parse
Expand Down Expand Up @@ -198,8 +199,7 @@ def get_openapi_version(app):
def attach_routers(app):
_LOGGER.info("Mounting routers...")
# importing routers here avoids circular imports
from .routers import bed_api, bedset_api, base, search_api
app.include_router(base.router)
from .routers import bed_api, bedset_api, search_api
app.include_router(bed_api.router)
app.include_router(bedset_api.router)
app.include_router(search_api.search_router)
Expand Down
20 changes: 3 additions & 17 deletions bedhost/main.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
import coloredlogs
import logging
import os
import sys
import uvicorn

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from . import _LOGGER
import bedhost.dependencies as dependencies
from .helpers import FileResponse, configure, attach_routers

from .cli import build_parser
from .const import (
CFG_PATH_KEY,
CFG_PATH_PIPELINE_OUTPUT_KEY,
CFG_REMOTE_KEY,
CFG_SERVER_HOST_KEY,
CFG_SERVER_KEY,
CFG_SERVER_PORT_KEY,
PKG_NAME,
STATIC_PATH,
SERVER_VERSION,
)
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles

app = FastAPI(
title=PKG_NAME,
Expand Down Expand Up @@ -54,13 +47,6 @@ async def index():
"""
return FileResponse(os.path.join(STATIC_PATH, "index.html"))

@app.get("/test", response_model=int)
async def get_bedfile_count():
"""
Returns the number of bedfiles available in the database
"""
return int(bbc.bed.record_count)

def main():
parser = build_parser()
args = parser.parse_args()
Expand Down
24 changes: 0 additions & 24 deletions bedhost/routers/base.py

This file was deleted.

0 comments on commit ba655de

Please sign in to comment.