Skip to content

Commit

Permalink
Update related files to the new dependencies (#49)
Browse files Browse the repository at this point in the history
Fix files that are related to new dependencies
  • Loading branch information
songmeo authored Nov 7, 2023
1 parent ac01b47 commit 6a40712
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
3 changes: 1 addition & 2 deletions nunaserver/nunaserver/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import typing
from typing import List
from pathlib import Path
from pydsdl import read_namespace
from pydsdl._error import InvalidDefinitionError
from pydsdl import read_namespace, InvalidDefinitionError
from nunavut import build_namespace_tree
from nunavut import DSDLCodeGenerator, SupportGenerator, AbstractGenerator, Namespace
from nunaserver import settings
Expand Down
4 changes: 1 addition & 3 deletions nunaserver/nunaserver/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def init_logging():

log_handler = logging.FileHandler(log_file)
loggers = [logging.getLogger()]
loggers = loggers + [
logging.getLogger(name) for name in logging.root.manager.loggerDict
]
loggers = loggers + [logging.getLogger(name) for name in logging.root.manager.loggerDict]
for logger in loggers:
logger.setLevel(settings.LOG_LEVEL)
logger.addHandler(log_handler)
9 changes: 9 additions & 0 deletions nunaserver/nunaserver/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -------------------------------------------------- BLACK --------------------------------------------------
[tool.black]
line-length = 120
target-version = ['py311']
include = '''
(nunaserver/.*\.pyi?$)
|
(noxfile.py$)
'''
9 changes: 2 additions & 7 deletions nunaserver/nunaserver/utils/archive_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def fetch_remote_namespace(url: str, arch_dir: Path):
raise RuntimeError("Only zip archives and Github are supported.")

if res.status_code != http.HTTPStatus.OK:
raise RuntimeError(
f"Could not download the archive; HTTP error {res.status_code}"
)
raise RuntimeError(f"Could not download the archive; HTTP error {res.status_code}")

fd, file_path = tempfile.mkstemp("dsdlarchive")

Expand Down Expand Up @@ -71,7 +69,4 @@ def zipdir(path, ziph):


def allowed_file(filename):
return (
"." in filename
and filename.rsplit(".", 1)[1].lower() in settings.ALLOWED_EXTENSIONS
)
return "." in filename and filename.rsplit(".", 1)[1].lower() in settings.ALLOWED_EXTENSIONS
7 changes: 1 addition & 6 deletions nunaserver/nunaserver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ def upload():

# Kick off Celery task to generate DSDL
task = generate_dsdl.delay(
build_uuid,
form.archive_urls,
form.target_lang,
form.target_endian,
form.flags,
form.doc_url
build_uuid, form.archive_urls, form.target_lang, form.target_endian, form.flags, form.doc_url
)

return (
Expand Down

0 comments on commit 6a40712

Please sign in to comment.