Commit e63f46b1 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Continued massive refactoring replacing files with new files(uploads) module.

parent 2c57208e
......@@ -24,7 +24,7 @@ from flask_restplus import abort, Resource
import nomad_meta_info
from nomad.uploads import UploadFiles, Restricted
from nomad.files import UploadFiles, Restricted
from .app import api
from .auth import login_if_available, create_authorization_predicate
......
......@@ -39,7 +39,7 @@ from flask import g, request, make_response
from flask_restplus import abort, Resource
from flask_httpauth import HTTPBasicAuth
from nomad import config, processing, uploads, utils, coe_repo
from nomad import config, processing, files, utils, coe_repo
from nomad.coe_repo import User, LoginException
from .app import app, api
......@@ -170,7 +170,7 @@ def create_authorization_predicate(upload_hash, calc_hash=None):
return str(g.user.user_id) == str(staging_upload.user_id)
# There are no db entries for the given resource
if uploads.UploadFiles.get(upload_hash) is not None:
if files.UploadFiles.get(upload_hash) is not None:
logger = utils.get_logger(__name__, upload_hash=upload_hash, calc_hash=calc_hash)
logger.error('Upload files without respective db entry')
......
......@@ -23,7 +23,7 @@ import zipstream
from flask import Response, request, send_file, stream_with_context
from flask_restplus import abort, Resource, fields
from nomad.uploads import UploadFiles, Restricted
from nomad.files import UploadFiles, Restricted
from .app import api
from .auth import login_if_available, create_authorization_predicate
......
......@@ -26,7 +26,7 @@ import os.path
from nomad import config, utils
from nomad.processing import Upload
from nomad.processing import NotAllowedDuringProcessing
from nomad.uploads import ArchiveBasedStagingUploadFiles, StagingUploadFiles, UploadFiles
from nomad.files import ArchiveBasedStagingUploadFiles, StagingUploadFiles, UploadFiles
from .app import api, with_logger
from .auth import login_really_required
......
......@@ -28,7 +28,7 @@ from bravado.requests_client import RequestsClient
from bravado.client import SwaggerClient
from nomad import config, utils
from nomad.uploads import ArchiveBasedStagingUploadFiles
from nomad.files import ArchiveBasedStagingUploadFiles
from nomad.parsing import parsers, parser_dict, LocalBackend
from nomad.normalizing import normalizers
......
......@@ -16,7 +16,7 @@
This module contains classes that allow to represent the core
nomad data entities :class:`Upload` and :class:`Calc` on a high level of abstraction
independent from their representation in the different modules :py:mod:`nomad.repo`,
:py:mod:`nomad.processing`, :py:mod:`nomad.coe_repo`, :py:mod:`nomad.uploads`.
:py:mod:`nomad.processing`, :py:mod:`nomad.coe_repo`, :py:mod:`nomad.files`.
It is not about representing every detail, but those parts that are directly involved in
api, processing, migration, mirroring, or other 'infrastructure' operations.
"""
......
......@@ -31,7 +31,7 @@ from structlog import wrap_logger
from contextlib import contextmanager
from nomad import utils, coe_repo, datamodel
from nomad.uploads import PathObject, ArchiveBasedStagingUploadFiles
from nomad.files import PathObject, ArchiveBasedStagingUploadFiles
from nomad.repo import RepoCalc, RepoUpload
from nomad.processing.base import Proc, Chord, process, task, PENDING, SUCCESS, FAILURE
from nomad.parsing import parsers, parser_dict
......
......@@ -26,15 +26,15 @@ import os.path
import json
from nomad import utils
from nomad.uploads import ArchiveBasedStagingUploadFiles, UploadFiles, StagingUploadFiles
from nomad.files import ArchiveBasedStagingUploadFiles, UploadFiles, StagingUploadFiles
from nomad.processing import Upload, Calc
from nomad.processing.base import task as task_decorator
from nomad.repo import RepoUpload
from tests.test_uploads import example_file, empty_file
from tests.test_files import example_file, empty_file
# import fixtures
from tests.test_uploads import clear_files # pylint: disable=unused-import
from tests.test_files import clear_files # pylint: disable=unused-import
example_files = [empty_file, example_file]
......
......@@ -29,13 +29,13 @@ services_config.update(api_base_path='')
config.services = config.NomadServicesConfig(**services_config)
from nomad import api, coe_repo # noqa
from nomad.uploads import UploadFiles, PublicUploadFiles # noqa
from nomad.files import UploadFiles, PublicUploadFiles # noqa
from nomad.processing import Upload, Calc # noqa
from nomad.coe_repo import User # noqa
from tests.processing.test_data import example_files # noqa
from tests.test_uploads import example_file, example_file_mainfile, example_file_contents # noqa
from tests.test_uploads import create_staging_upload, create_public_upload # noqa
from tests.test_files import example_file, example_file_mainfile, example_file_contents # noqa
from tests.test_files import create_staging_upload, create_public_upload # noqa
# import fixtures
from tests.test_normalizing import normalized_template_example # noqa pylint: disable=unused-import
......
......@@ -20,7 +20,7 @@ from nomad.coe_repo import User, Calc, Upload
from tests.processing.test_data import processed_upload # pylint: disable=unused-import
from tests.processing.test_data import uploaded_id # pylint: disable=unused-import
from tests.processing.test_data import mocks_forall # pylint: disable=unused-import
from tests.test_uploads import clear_files # pylint: disable=unused-import
from tests.test_files import clear_files # pylint: disable=unused-import
def assert_user(user, reference):
......
......@@ -20,9 +20,9 @@ import pytest
import json
from nomad import config
from nomad.uploads import DirectoryObject, PathObject
from nomad.uploads import Metadata, MetadataTimeout, PublicMetadata, StagingMetadata
from nomad.uploads import StagingUploadFiles, PublicUploadFiles, UploadFiles, Restricted, \
from nomad.files import DirectoryObject, PathObject
from nomad.files import Metadata, MetadataTimeout, PublicMetadata, StagingMetadata
from nomad.files import StagingUploadFiles, PublicUploadFiles, UploadFiles, Restricted, \
ArchiveBasedStagingUploadFiles
......
......@@ -20,7 +20,7 @@
# from nomad.parsing import LocalBackend
# from nomad.repo import AlreadyExists, RepoCalc
# from tests.test_uploads import example_file # noqa
# from tests.test_files import example_file # noqa
# from tests.test_normalizing import normalized_template_example # pylint: disable=unused-import
# from tests.test_parsing import parsed_template_example # pylint: disable=unused-import
......
......@@ -16,7 +16,7 @@ import pytest
from nomad.client import create_client, upload_file
from tests.test_uploads import example_file
from tests.test_files import example_file
@pytest.fixture(scope='session')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment