Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
e63f46b1
Commit
e63f46b1
authored
Jan 12, 2019
by
Markus Scheidgen
Browse files
Continued massive refactoring replacing files with new files(uploads) module.
parent
2c57208e
Changes
14
Hide whitespace changes
Inline
Side-by-side
nomad/api/archive.py
View file @
e63f46b1
...
...
@@ -24,7 +24,7 @@ from flask_restplus import abort, Resource
import
nomad_meta_info
from
nomad.
upload
s
import
UploadFiles
,
Restricted
from
nomad.
file
s
import
UploadFiles
,
Restricted
from
.app
import
api
from
.auth
import
login_if_available
,
create_authorization_predicate
...
...
nomad/api/auth.py
View file @
e63f46b1
...
...
@@ -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
,
upload
s
,
utils
,
coe_repo
from
nomad
import
config
,
processing
,
file
s
,
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
upload
s
.
UploadFiles
.
get
(
upload_hash
)
is
not
None
:
if
file
s
.
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'
)
...
...
nomad/api/raw.py
View file @
e63f46b1
...
...
@@ -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.
upload
s
import
UploadFiles
,
Restricted
from
nomad.
file
s
import
UploadFiles
,
Restricted
from
.app
import
api
from
.auth
import
login_if_available
,
create_authorization_predicate
...
...
nomad/api/upload.py
View file @
e63f46b1
...
...
@@ -26,7 +26,7 @@ import os.path
from
nomad
import
config
,
utils
from
nomad.processing
import
Upload
from
nomad.processing
import
NotAllowedDuringProcessing
from
nomad.
upload
s
import
ArchiveBasedStagingUploadFiles
,
StagingUploadFiles
,
UploadFiles
from
nomad.
file
s
import
ArchiveBasedStagingUploadFiles
,
StagingUploadFiles
,
UploadFiles
from
.app
import
api
,
with_logger
from
.auth
import
login_really_required
...
...
nomad/client.py
View file @
e63f46b1
...
...
@@ -28,7 +28,7 @@ from bravado.requests_client import RequestsClient
from
bravado.client
import
SwaggerClient
from
nomad
import
config
,
utils
from
nomad.
upload
s
import
ArchiveBasedStagingUploadFiles
from
nomad.
file
s
import
ArchiveBasedStagingUploadFiles
from
nomad.parsing
import
parsers
,
parser_dict
,
LocalBackend
from
nomad.normalizing
import
normalizers
...
...
nomad/datamodel.py
View file @
e63f46b1
...
...
@@ -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.
upload
s`.
:py:mod:`nomad.processing`, :py:mod:`nomad.coe_repo`, :py:mod:`nomad.
file
s`.
It is not about representing every detail, but those parts that are directly involved in
api, processing, migration, mirroring, or other 'infrastructure' operations.
"""
...
...
nomad/
upload
s.py
→
nomad/
file
s.py
View file @
e63f46b1
File moved
nomad/processing/data.py
View file @
e63f46b1
...
...
@@ -31,7 +31,7 @@ from structlog import wrap_logger
from
contextlib
import
contextmanager
from
nomad
import
utils
,
coe_repo
,
datamodel
from
nomad.
upload
s
import
PathObject
,
ArchiveBasedStagingUploadFiles
from
nomad.
file
s
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
...
...
tests/processing/test_data.py
View file @
e63f46b1
...
...
@@ -26,15 +26,15 @@ import os.path
import
json
from
nomad
import
utils
from
nomad.
upload
s
import
ArchiveBasedStagingUploadFiles
,
UploadFiles
,
StagingUploadFiles
from
nomad.
file
s
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_
upload
s
import
example_file
,
empty_file
from
tests.test_
file
s
import
example_file
,
empty_file
# import fixtures
from
tests.test_
upload
s
import
clear_files
# pylint: disable=unused-import
from
tests.test_
file
s
import
clear_files
# pylint: disable=unused-import
example_files
=
[
empty_file
,
example_file
]
...
...
tests/test_api.py
View file @
e63f46b1
...
...
@@ -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.
upload
s
import
UploadFiles
,
PublicUploadFiles
# noqa
from
nomad.
file
s
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_
upload
s
import
example_file
,
example_file_mainfile
,
example_file_contents
# noqa
from
tests.test_
upload
s
import
create_staging_upload
,
create_public_upload
# noqa
from
tests.test_
file
s
import
example_file
,
example_file_mainfile
,
example_file_contents
# noqa
from
tests.test_
file
s
import
create_staging_upload
,
create_public_upload
# noqa
# import fixtures
from
tests.test_normalizing
import
normalized_template_example
# noqa pylint: disable=unused-import
...
...
tests/test_coe_repo.py
View file @
e63f46b1
...
...
@@ -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_
upload
s
import
clear_files
# pylint: disable=unused-import
from
tests.test_
file
s
import
clear_files
# pylint: disable=unused-import
def
assert_user
(
user
,
reference
):
...
...
tests/test_
upload
s.py
→
tests/test_
file
s.py
View file @
e63f46b1
...
...
@@ -20,9 +20,9 @@ import pytest
import
json
from
nomad
import
config
from
nomad.
upload
s
import
DirectoryObject
,
PathObject
from
nomad.
upload
s
import
Metadata
,
MetadataTimeout
,
PublicMetadata
,
StagingMetadata
from
nomad.
upload
s
import
StagingUploadFiles
,
PublicUploadFiles
,
UploadFiles
,
Restricted
,
\
from
nomad.
file
s
import
DirectoryObject
,
PathObject
from
nomad.
file
s
import
Metadata
,
MetadataTimeout
,
PublicMetadata
,
StagingMetadata
from
nomad.
file
s
import
StagingUploadFiles
,
PublicUploadFiles
,
UploadFiles
,
Restricted
,
\
ArchiveBasedStagingUploadFiles
...
...
tests/test_repo.py
View file @
e63f46b1
...
...
@@ -20,7 +20,7 @@
# from nomad.parsing import LocalBackend
# from nomad.repo import AlreadyExists, RepoCalc
# from tests.test_
upload
s import example_file # noqa
# from tests.test_
file
s 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
...
...
tests_integration/test_client.py
View file @
e63f46b1
...
...
@@ -16,7 +16,7 @@ import pytest
from
nomad.client
import
create_client
,
upload_file
from
tests.test_
upload
s
import
example_file
from
tests.test_
file
s
import
example_file
@
pytest
.
fixture
(
scope
=
'session'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment