Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
erogol committed May 10, 2021
1 parent 4aa6456 commit b2dac6d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions coqpit/coqpit.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,12 @@ def __getitem__(self, arg: str):
def __delitem__(self, arg: str):
delattr(self, arg)

def _keytransform(self, key):
def _keytransform(self, key): # pylint: disable=no-self-use
return key

## end `dict` API functions

def __getattribute__(self, arg: str):
def __getattribute__(self, arg: str): # pylint: disable=no-self-use
"""Check if the mandatory field is defined when accessing it."""
value = super().__getattribute__(arg)
if isinstance(value, str) and value == "???":
Expand Down
1 change: 0 additions & 1 deletion tests/test_merge_configs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from dataclasses import dataclass

from coqpit.coqpit import Coqpit
Expand Down
2 changes: 0 additions & 2 deletions tests/test_parse_argparse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import argparse
import os
import sys
from dataclasses import asdict, dataclass, field
from typing import List

Expand Down
8 changes: 5 additions & 3 deletions tests/test_simple_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ class SimpleConfig(Coqpit):
val_b: int = None
val_d: float = 10.21
val_c: str = "Coqpit is great!"
val_k: int = MISSING # raise an error when accessing the value if it is not changed. It is a way to define
# mandatory fields
# mandatory field
# raise an error when accessing the value if it is not changed. It is a way to define
val_k: int = MISSING
# optional field
val_dict: dict = field(default_factory=lambda: {"val_aa": 10, "val_ss": "This is in a dict."})

def check_values(
Expand All @@ -30,7 +32,7 @@ def test_simple_config():

# try MISSING class argument
try:
k = config.val_k
config.val_k
except AttributeError:
print(" val_k needs a different value before accessing it.")
config.val_k = 1000
Expand Down

0 comments on commit b2dac6d

Please sign in to comment.