Skip to content

Commit

Permalink
Fix type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Sep 5, 2023
1 parent a6f8cfa commit 0bd793b
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/ert/config/parsing/config_schema_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,27 +222,26 @@ def apply_constraints(
if self.argc_max == 1 and self.argc_min == 1:
return args_with_context[0]

if args:
if keyword == "QUEUE_OPTION" and args[-1] == "$ERT_LSF_SERVER":
raise ConfigValidationError.with_context(
if keyword == "QUEUE_OPTION" and value_with_context == "$ERT_LSF_SERVER":
raise ConfigValidationError.with_context(
(
"Enviroment variable $ERT_LSF_SERVER does not exist. The"
" LSF_SERVER options is usually "
" specified in the site config file."
),
value_with_context,
)
if value_with_context.startswith("$"):

Check failure on line 234 in src/ert/config/parsing/config_schema_item.py

View workflow job for this annotation

GitHub Actions / type-checking (3.11)

Item "ContextFloat" of "ContextString | ContextFloat | ContextInt | ContextBool | None" has no attribute "startswith"

Check failure on line 234 in src/ert/config/parsing/config_schema_item.py

View workflow job for this annotation

GitHub Actions / type-checking (3.11)

Item "ContextInt" of "ContextString | ContextFloat | ContextInt | ContextBool | None" has no attribute "startswith"

Check failure on line 234 in src/ert/config/parsing/config_schema_item.py

View workflow job for this annotation

GitHub Actions / type-checking (3.11)

Item "ContextBool" of "ContextString | ContextFloat | ContextInt | ContextBool | None" has no attribute "startswith"

Check failure on line 234 in src/ert/config/parsing/config_schema_item.py

View workflow job for this annotation

GitHub Actions / type-checking (3.11)

Item "None" of "ContextString | ContextFloat | ContextInt | ContextBool | None" has no attribute "startswith"
warnings.warn(
ConfigWarning.with_context(
(
"Enviroment variable $ERT_LSF_SERVER does not exist. The"
" LSF_SERVER options is usually "
" specified in the site config file."
f"Environment variable {value_with_context} may not be"
" defined."
),
value_with_context,

Check failure on line 241 in src/ert/config/parsing/config_schema_item.py

View workflow job for this annotation

GitHub Actions / type-checking (3.11)

Argument 2 to "with_context" of "ConfigWarning" has incompatible type "ContextString | ContextFloat | ContextInt | ContextBool | None"; expected "ContextString | ContextFloat | ContextInt | ContextBool | float | bool | str | int | FileContextToken | list[Any]"
)
if args[-1].startswith("$"):
warnings.warn(
ConfigWarning.with_context(
(
f"Environment variable {value_with_context} may not be"
" defined."
),
value_with_context,
),
stacklevel=1,
)
),
stacklevel=1,
)

return args_with_context

Expand Down

0 comments on commit 0bd793b

Please sign in to comment.