Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianDeconinck committed May 21, 2024
1 parent 2777c74 commit 0722e58
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ repos:
hooks:
- id: mypy
name: mypy-pyMoist
args: [--config, GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/python/model/setup.cfg]
args: [
--ignore-missing-imports,
"--follow-imports=normal",
--namespace-packages,
--no-strict-optional,
--warn-unreachable,
--explicit-package-bases,
]
additional_dependencies: [types-PyYAML]
files: pyMoist

Expand All @@ -39,7 +46,11 @@ repos:
- id: flake8
name: flake8
language_version: python3
args: [--config, setup.cfg]
args: [
"--exclude=docs",
"--ignore=W503,E302,E203,F841",
"--max-line-length=88"
]
exclude: |
(?x)^(
.*/__init__.py |
Expand All @@ -48,4 +59,7 @@ repos:
name: flake8 __init__.py files
files: "__init__.py"
# ignore unused import error in __init__.py files
args: ["--ignore=F401,E203", --config, setup.cfg]
args: [
"--exclude=docs",
"--ignore=W503,E302,E203,F841,F401",
"--max-line-length=88",]
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ The `interface` sub-directory contain the three-way bridge to and from GEOS.

## Develop

- Run `pre-commit run --all-files` before comitting for code guidelines coherency.
- Run `pre-commit run --all-files` before comitting for code guidelines coherency.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Interface between GEOS and pyMoist
# Interface between GEOS and pyMoist

This is the `cffi` based interface between the GEOS Moist grid component and the `pyMoist` NDSL numerical code.
This is the `cffi` based interface between the GEOS Moist grid component and the `pyMoist` NDSL numerical code.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ commit = True
[bdist_wheel]
universal = 1

[flake8]
[flake8] # WARNING: This configuration is duplicated in pre-commit-config.yaml due to pre-config lack of working dir
exclude = docs
ignore = W503,E302,E203,F841
max-line-length = 88
Expand All @@ -24,7 +24,7 @@ sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
known_first_party = pyMoist,ndsl
known_third_party = f90nml,pytest,xarray,numpy,mpi4py,gt4py

[mypy]
[mypy] # WARNING: This configuration is duplicated in pre-commit-config.yaml due to pre-config lack of working dir
ignore_missing_imports = True
follow_imports = normal
namespace_packages = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
with open("README.md", encoding="utf-8") as readme_file:
readme = readme_file.read()

requirements = []

test_requirements = ["pytest", "pytest-subtests", "serialbox", "coverage"]
ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@2024.04.00"]
develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"]
Expand All @@ -32,8 +30,8 @@
"Natural Language :: English",
"Programming Language :: Python :: 3.11",
],
description="pyMoist is the NDSL version of NASA GMAO's GEOS Moist physics.",
install_requires=requirements,
description=("pyMoist is the NDSL version of NASA GMAO's GEOS Moist physics."),
install_requires=[],
extras_require=extras_requires,
license="BSD license",
long_description=readme,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import savepoint

import ndsl.stencils.testing.conftest
from ndsl.stencils.testing.conftest import * # noqa: F403,F401

import savepoint

# Point to an __init__.py where all the TestX are improted
ndsl.stencils.testing.conftest.translate = savepoint # type: ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ndsl.stencils.testing.translate import TranslateFortranData2Py
from ndsl import Namelist, StencilFactory
from ndsl.stencils.testing.translate import TranslateFortranData2Py
from pyMoist.radiation_coupling import RadiationCoupling


Expand All @@ -11,10 +11,10 @@ def __init__(
stencil_factory: StencilFactory,
):
super().__init__(grid, stencil_factory)
self.compute_func = RadiationCoupling( # type: ignore
self.compute_func = RadiationCoupling( # type: ignore
self.stencil_factory,
self.grid.quantity_factory,
do_qa=namelist.do_qa
do_qa=namelist.do_qa,
)

# ADAPT BELOW TO INPUTS
Expand All @@ -31,7 +31,6 @@ def __init__(
# "q": self.grid.compute_dict(),
# }


def compute_from_storage(self, inputs):
self.compute_func(**inputs)
return inputs

0 comments on commit 0722e58

Please sign in to comment.