question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] MISSING for Object Conf cls argument

See original GitHub issue

🐛 Bug

OmegaConf cls argument should not be a mandatory value if target is defined. Can we change this to be an optional value with None being the default?

** Stack trace/error message **

omegaconf.errors.MissingMandatoryValue: Missing mandatory value: scheduler.cls
        full_key: scheduler.cls
        reference_type=ObjectConf
        object_type=ObjectConf

System information

  • Hydra Version : 1.0.0rc2
  • Python version : 3.7.7

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
omrycommented, Jul 18, 2020

@shagunsodhani , please clean this up. dunno why I missed it:

@dataclass
# This extends Dict[str, Any] to allow for the deprecated "class" field.
# Once support for class field removed this can stop extending Dict.
class ObjectConf(Dict[str, Any]):
    # class, class method or function name
    target: str = MISSING

    # parameters to pass to cls when calling it
    params: Any = field(default_factory=dict)

    # cls is deprecated, use target, cls will be removed in Hydra 1.1
    cls: str = MISSING

    # class is deprecated, use target, class will be removed in Hydra 1.1
    # (class is Python keyword and is only supported through DictConfig)
    # class: str = MISSING

You can completely remove everytging after params. just kill cls, this was introduced in Hydra 1.0 and it’s not yet released. I don’t mind breaking here.

0reactions
omrycommented, Jul 18, 2020

Yes. We keep this was as a deprecation. This is much cheaper and is not contaminating interfaces.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix this TypeError for missing 'self' argument
Oops, __new__ receives the class and is supposed to return the newly created object! As your code returns the class itself, thing go...
Read more >
bad-classmethod-argument / C0202 - Pylint 2.16.0-dev ...
Description: Used when a class method has a first argument named differently than the value specified in valid-classmethod-first-arg option (default to "cls"), ...
Read more >
System Error Messages - InterSystems Documentation
This can indicate that the routine's OBJ code (object code) is corrupt, which can possibly lead to database degradation. Contact your system manager....
Read more >
inspect — Inspect live objects — Python 3.11.1 documentation
Return a list of source lines and starting line number for an object. The argument may be a module, class, method, function, traceback,...
Read more >
Python Class Constructors: Control Your Object Instantiation
Note that using cls as the name of this argument is a strong convention in Python, just like using self to name the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found