Skip to content

Commit

Permalink
blacked .
Browse files Browse the repository at this point in the history
  • Loading branch information
benmalef committed Feb 1, 2025
1 parent adc2ebc commit 24de26a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
6 changes: 4 additions & 2 deletions GANDLF/Configuration/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
from GANDLF.Configuration.default_parameters import DefaultParameters
from GANDLF.Configuration.user_defined_parameters import UserDefinedParameters


class ParametersConfiguration(BaseModel):
model_config = ConfigDict()

class Parameters(ParametersConfiguration,DefaultParameters,UserDefinedParameters):
pass

class Parameters(ParametersConfiguration, DefaultParameters, UserDefinedParameters):
pass
8 changes: 5 additions & 3 deletions GANDLF/Configuration/user_defined_parameters.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from pydantic import BaseModel,field_validator
from GANDLF.config_manager import version_check
from pydantic import BaseModel, field_validator
from GANDLF.config_manager import version_check
from importlib.metadata import version


class Version(BaseModel):
minimum: str
maximum: str


class UserDefinedParameters(BaseModel):
version: Version

@classmethod
@field_validator('version', mode='after')
@field_validator("version", mode="after")
def validate_version(cls, values: Version) -> Version:
if version_check(values.model_dump(), version_to_check=version("GANDLF")):
return values
3 changes: 0 additions & 3 deletions GANDLF/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ def _parseConfig(
# if initialize_inference_mechanism:
# params["inference_mechanism"] = inference_mechanism


return params


Expand Down Expand Up @@ -767,5 +766,3 @@ def ConfigManager(
# # raise
except ValidationError as exc:
print(exc.errors())


4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
"openslide-bin",
"openslide-python==1.4.1",
"lion-pytorch==0.2.2",
"pydantic"
]
"pydantic",
]

if __name__ == "__main__":
setup(
Expand Down
6 changes: 4 additions & 2 deletions test_configuration/test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from GANDLF.config_manager import ConfigManager
from pathlib import Path

if __name__ == "__main__":
testingDir = Path(__file__).parent.absolute().__str__()
parameters = ConfigManager(testingDir+"/config_all_options.yaml",version_check_flag=False)
parameters = ConfigManager(
testingDir + "/config_all_options.yaml", version_check_flag=False
)
print(parameters)

1 comment on commit 24de26a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (1)

vere

Some files were automatically ignored 🙈

These sample patterns would exclude them:

[^/]\.png$
^\Q.gitattributes\E$
^\Q.spelling/.spelling/expect.txt\E$
^\Q__init__.py\E$
^\QGANDLF/Configuration/__init__.py\E$
^\QGANDLF/data/patch_miner/__init__.py\E$
^\QGANDLF/data/patch_miner/opm/__init__.py\E$
^\QGANDLF/grad_clipping/__init__.py\E$
^\QGANDLF/models/seg_modules/__init__.py\E$
^\QGANDLF/privacy/__init__.py\E$
^\Qtesting/__init__.py\E$
^\Qtutorials/classification_medmnist_notebook/tutorial.ipynb\E$
^samples/images_opm/
^tutorials/classification_medmnist_notebook/medmnist/dataset/

You should consider excluding directory paths (e.g. (?:^|/)vendor/), filenames (e.g. (?:^|/)yarn\.lock$), or file extensions (e.g. \.gz$)

You should consider adding them to:

.github/actions/spelling/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct and update file exclusions, you could run the following commands

... in a clone of the [email protected]:benmalef/GaNDLF.git repository
on the 976-add-pydantic-configuration-v1 branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/benmalef/GaNDLF/actions/runs/13090378642/attempts/1'
Available 📚 dictionaries could cover words not in the 📘 dictionary
Dictionary Entries Covers Uniquely
cspell:java/src/java-terms.txt 920 2 2

Consider adding them (in .github/workflows/spellchecker.yml) in jobs:/spelling: for uses: check-spelling/check-spelling@main in its with:

      with:
        extra_dictionaries: |
          cspell:java/src/java-terms.txt

To stop checking additional dictionaries, add (in .github/workflows/spellchecker.yml) for uses: check-spelling/check-spelling@main in its with:

check_extra_dictionaries: ''
Warnings (3)

See the 📜action log or 📝 job summary for details.

⚠️ Warnings Count
⚠️ binary-file 20
⚠️ large-file 2
⚠️ noisy-file 2

See ⚠️ Event descriptions for more information.

Please sign in to comment.