Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
modelcif-converters
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
modelcif-converters
Commits
8a3c8bb0
Commit
8a3c8bb0
authored
1 year ago
by
B13nch3n
Browse files
Options
Downloads
Patches
Plain Diff
PEP8 for validator code, improved dev-mode in validator container
parent
9bc58fb1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+20
-0
20 additions, 0 deletions
pyproject.toml
validation/Dockerfile
+16
-4
16 additions, 4 deletions
validation/Dockerfile
validation/validate-mmcif-file.py
+16
-4
16 additions, 4 deletions
validation/validate-mmcif-file.py
with
52 additions
and
8 deletions
pyproject.toml
+
20
−
0
View file @
8a3c8bb0
...
...
@@ -12,3 +12,23 @@ extension-pkg-allow-list='rapidjson'
[tool.pylint.FORMAT]
max-line-length
=
80
[tool.pylint.deprecated_builtins]
# We want to use proper logging, so we can control *ALL* output bei the Abseil
# logger, hence: deprecate 'print'
bad-functions
=
[
"map"
,
"filter"
,
"print"
]
# Run the spell check every once in a while, having it enabled always, is too
# annoying.
[tool.pylint.spelling]
max-spelling-suggestions
=
4
spelling-dict
=
"en_GB"
spelling-ignore-comment-directives
=
"fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:"
spelling-ignore-words
=
""
spelling-private-dict-file
=
".spelling"
spelling-store-unknown-words
=
false
This diff is collapsed.
Click to expand it.
validation/Dockerfile
+
16
−
4
View file @
8a3c8bb0
ARG
VERSION_PYTHON="3.9"
ARG
VERSION_BASE_IMAGE="python:${VERSION_PYTHON}-alpine3.1
7
"
ARG
VERSION_BASE_IMAGE="python:${VERSION_PYTHON}-alpine3.1
9
"
FROM
${VERSION_BASE_IMAGE}
# We need to declare ARGs again which were declared before the build stage
# (FROM directive), otherwise they won't be available in this stage.
...
...
@@ -141,10 +141,22 @@ RUN set -e pipefail; \
ARG
ADD_DEV
RUN
set
-e
pipefail
;
\
if
test
xYES
=
x
`
echo
${
ADD_DEV
}
|
tr
'[:lower:]'
'[:upper:]'
`
;
then
\
apk add bash emacs gcc build-base
;
\
/usr/local/bin/python
-m
pip
install
pylint black
;
\
apk add bash
\
binutils
\
build-base
\
emacs
\
enchant2-dev
\
gcc
\
hunspell-en-gb
\
py3-enchant
;
\
/usr/local/bin/python
-m
pip
install
pylint[spelling] black
;
\
apk del gcc build-base
;
\
fi
fi
;
\
# the alias assumes you are in the directory containing the code
\
echo
"alias black_n_pylint=
\"
black --config ../pyproject.toml "
\
"test-suite.py validate-mmcif-file.py && pylint "
\
"--rc-file=../pyproject.toml test-suite.py validate-mmcif-file.py
\"
"
\
>>
/etc/bash/bashrc
## Add a dedicated user for mmCIF file validation
## MMCIF_USER_ID can be used to avoid file permission issues in development.
...
...
This diff is collapsed.
Click to expand it.
validation/validate-mmcif-file.py
+
16
−
4
View file @
8a3c8bb0
...
...
@@ -490,7 +490,11 @@ class _CifCheck:
def
__init__
(
self
,
dict_sdb
,
json_out_file
=
None
,
verbose
=
False
):
self
.
_version
=
None
self
.
check_results
=
{
"
errors
"
:
[],
"
diagnosis
"
:
[],
"
cifcheck-errors
"
:
[]}
self
.
check_results
=
{
"
errors
"
:
[],
"
diagnosis
"
:
[],
"
cifcheck-errors
"
:
[],
}
self
.
dict_sdb
=
os
.
path
.
abspath
(
dict_sdb
)
self
.
json_out_file
=
json_out_file
self
.
verbose
=
verbose
...
...
@@ -812,12 +816,20 @@ class _CifCheck:
"
missing_files
"
:
{},
}
for
line
in
self
.
check_results
[
"
errors
"
]:
match
=
re
.
match
(
r
"
ma_entry_associated_files.file_url
'
(?P<arc>.*)
'
is missing ma_associated_archive_file_details.file_path
'
(?P<fle>.*)
'"
,
line
)
match
=
re
.
match
(
r
"
ma_entry_associated_files.file_url
'
(?P<arc>.*)
'
is missing
"
+
r
"
ma_associated_archive_file_details.file_path
'
(?P<fle>.*)
'"
,
line
,
)
if
match
is
not
None
:
try
:
rprt
[
"
missing_files
"
][
match
.
group
(
'
arc
'
)].
append
(
match
.
group
(
'
fle
'
))
rprt
[
"
missing_files
"
][
match
.
group
(
"
arc
"
)].
append
(
match
.
group
(
"
fle
"
)
)
except
KeyError
:
rprt
[
"
missing_files
"
][
match
.
group
(
'
arc
'
)]
=
[
match
.
group
(
'
fle
'
)]
rprt
[
"
missing_files
"
][
match
.
group
(
"
arc
"
)]
=
[
match
.
group
(
"
fle
"
)
]
continue
# Unmatched lines need to be added to above evaluation
raise
RuntimeError
(
f
'
Unmatched error line found:
\n
"""
{
line
}
"""'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment