access-config-utils 0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- access/config/__init__.py +24 -0
- access/config/config.lark +64 -0
- access/config/esm1p6_layout_input.py +663 -0
- access/config/fortran_nml.py +70 -0
- access/config/layout_config.py +180 -0
- access/config/mom6_input.py +64 -0
- access/config/nuopc_config.py +130 -0
- access/config/parser.py +440 -0
- access/config/yaml_config.py +53 -0
- access_config_utils-0.1.dist-info/METADATA +129 -0
- access_config_utils-0.1.dist-info/RECORD +14 -0
- access_config_utils-0.1.dist-info/WHEEL +5 -0
- access_config_utils-0.1.dist-info/licenses/LICENSE +201 -0
- access_config_utils-0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
access-config-utils package.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from contextlib import suppress
|
|
6
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
7
|
+
|
|
8
|
+
__version__ = "unknown"
|
|
9
|
+
with suppress(PackageNotFoundError):
|
|
10
|
+
__version__ = version("access-config-utils")
|
|
11
|
+
|
|
12
|
+
from access.config.fortran_nml import FortranNMLParser
|
|
13
|
+
from access.config.mom6_input import MOM6InputParser
|
|
14
|
+
from access.config.nuopc_config import NUOPCParser
|
|
15
|
+
from access.config.parser import ConfigParser
|
|
16
|
+
from access.config.yaml_config import YAMLParser
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"ConfigParser",
|
|
20
|
+
"FortranNMLParser",
|
|
21
|
+
"MOM6InputParser",
|
|
22
|
+
"YAMLParser",
|
|
23
|
+
"NUOPCParser",
|
|
24
|
+
]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright 2025 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// Common terminals and rules for use in all ACCESS configuration parsers
|
|
5
|
+
|
|
6
|
+
// Dictionary keys
|
|
7
|
+
key : CNAME
|
|
8
|
+
|
|
9
|
+
// Fortran logicals
|
|
10
|
+
logical: FTRUE | FFALSE
|
|
11
|
+
FTRUE: ".true."i
|
|
12
|
+
FFALSE: ".false."i
|
|
13
|
+
|
|
14
|
+
// Booleans
|
|
15
|
+
bool: TRUE | FALSE
|
|
16
|
+
TRUE: "True"
|
|
17
|
+
FALSE: "False"
|
|
18
|
+
|
|
19
|
+
// Integers
|
|
20
|
+
integer: SIGNED_INT
|
|
21
|
+
|
|
22
|
+
// Floats
|
|
23
|
+
float: SIGNED_FLOAT
|
|
24
|
+
|
|
25
|
+
// Fortran double values
|
|
26
|
+
double: SIGNED_DOUBLE
|
|
27
|
+
_DOUBLE_EXP : ("d"|"D") SIGNED_INT
|
|
28
|
+
DOUBLE : INT _DOUBLE_EXP | DECIMAL _DOUBLE_EXP?
|
|
29
|
+
SIGNED_DOUBLE : ["+"|"-"] DOUBLE
|
|
30
|
+
|
|
31
|
+
// Fortran complex floats
|
|
32
|
+
complex: CMPLX
|
|
33
|
+
CMPLX: "(" WS_INLINE* SIGNED_FLOAT WS_INLINE* "," WS_INLINE* SIGNED_FLOAT WS_INLINE* ")"
|
|
34
|
+
|
|
35
|
+
// Fortran complex doubles
|
|
36
|
+
double_complex: DCMPLX
|
|
37
|
+
DCMPLX: "(" WS_INLINE* SIGNED_DOUBLE WS_INLINE* "," WS_INLINE* SIGNED_DOUBLE WS_INLINE* ")"
|
|
38
|
+
|
|
39
|
+
// Identifiers
|
|
40
|
+
identifier: CNAME
|
|
41
|
+
|
|
42
|
+
// Quoted strings
|
|
43
|
+
string: STRING
|
|
44
|
+
STRING: /(".*?(?<!\\)(\\\\)*?"|'(?!'').*?(?<!\\)(\\\\)*?')/
|
|
45
|
+
|
|
46
|
+
// Unix-like filesystem paths
|
|
47
|
+
path: PATH
|
|
48
|
+
PATH_COMPONENT : /[a-zA-Z0-9._-]+/
|
|
49
|
+
PATH : ("/" | "./" | "../")? PATH_COMPONENT ("/" PATH_COMPONENT)* ("/")?
|
|
50
|
+
|
|
51
|
+
// Space, newlines and comments
|
|
52
|
+
ws: WS_INLINE
|
|
53
|
+
NEWLINE: CR? LF
|
|
54
|
+
comment: /[ \t]*#[^\n]*/
|
|
55
|
+
fortran_comment: /[ \t]*![^\n]*/
|
|
56
|
+
|
|
57
|
+
%import common.CNAME
|
|
58
|
+
%import common.SIGNED_INT
|
|
59
|
+
%import common.SIGNED_FLOAT
|
|
60
|
+
%import common.INT
|
|
61
|
+
%import common.DECIMAL
|
|
62
|
+
%import common.CR
|
|
63
|
+
%import common.LF
|
|
64
|
+
%import common.WS_INLINE
|