Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/marin-community/draccus
/ functions
Functions
407 in github.com/marin-community/draccus
⨍
Functions
407
◇
Types & classes
156
↓ 113 callers
Method
setup
Basic setup for a tests. Keyword Arguments: arguments {Optional[str]} -- The arguments to pass to the parser (default: {""})
tests/testutils.py:86
↓ 58 callers
Function
field
( *, default=dataclasses.MISSING, default_factory=dataclasses.MISSING, init=True, repr=Tru
draccus/fields.py:8
↓ 50 callers
Function
encode
Encodes an object into a json/yaml-compatible primitive type. Args: obj: The object to encode declared_type: Optional type annota
draccus/parsers/encoding.py:71
↓ 17 callers
Function
decode
(cls: Type[T], raw_value: Any)
draccus/parsers/decoding.py:64
↓ 15 callers
Method
get_help_text
(cls, flag="--help")
tests/testutils.py:110
↓ 14 callers
Function
get_type_arguments
(container_type: Type)
draccus/utils.py:265
↓ 12 callers
Function
parse
Parses the command line arguments and returns an instance of the config class. Args: config_class: The config class to parse.
draccus/argparsing.py:194
↓ 11 callers
Function
get_attribute_docstring
Returns the docstrings of a dataclass field. NOTE: a docstring can either be: - An inline comment, starting with <#> - A Comment on the pr
draccus/wrappers/docstring.py:70
↓ 10 callers
Function
raises
(exception=ParsingError, match=None, code: Optional[int] = None)
tests/testutils.py:33
↓ 9 callers
Function
get_decoding_fn
Fetches/Creates a decoding function for the given type annotation. This decoding function can then be used to create an instance of the type
draccus/parsers/decoding.py:229
↓ 8 callers
Function
is_union
(t: Type)
draccus/utils.py:192
↓ 7 callers
Function
_contains_attribute_definition
Returns whether or not a line contains a dataclass field definition. Arguments: line_str {str} -- the line content Returns:
draccus/wrappers/docstring.py:146
↓ 7 callers
Method
add_argument
(self, *args, **kwargs)
draccus/wrappers/suppressing_argparse.py:36
↓ 6 callers
Function
_mro
(t: Type)
draccus/utils.py:134
↓ 6 callers
Method
register_subclass
(cls, name: str, choice_type: Type)
draccus/choice_types.py:97
↓ 6 callers
Function
stringify_type
(tpe: Type)
draccus/utils.py:462
↓ 5 callers
Method
get_config_type
()
draccus/options.py:26
↓ 5 callers
Function
get_preferred_help_text
(doc: AttributeDocString, preferred_help: str = HelpOrder.inline)
draccus/wrappers/docstring.py:46
↓ 5 callers
Function
is_dataclass_type
Returns whether t is a dataclass type or a TypeVar of a dataclass type. Args: t (Type): Some type. Returns: bool: Whether it
draccus/utils.py:166
↓ 4 callers
Method
__init__
(self, *args, **kwargs)
draccus/parsers/yaml_loader.py:79
↓ 4 callers
Function
get_args
(some_type: Type)
draccus/utils.py:44
↓ 4 callers
Method
get_choice_name
Returns the name of the given subclass of this choice type.
draccus/choice_types.py:59
↓ 4 callers
Function
is_choice_type
Returns True if 1) cls is a ChoiceRegistry/PluginRegistry/QNamePluginRegistry, or a *direct* subclass of one of those OR 2) cls struc
draccus/utils.py:381
↓ 4 callers
Function
is_tuple
(t: Type)
draccus/utils.py:152
↓ 4 callers
Method
set_config_type
(new_type: Union[ConfigType, str])
draccus/options.py:20
↓ 3 callers
Function
TaskHyperParameters
Test fixture that gives a good example use-case from a real datascience project.
tests/conftest.py:101
↓ 3 callers
Method
_discover_packages
(cls)
draccus/choice_types.py:193
↓ 3 callers
Method
add_argument_group
(self, *args, **kwargs)
draccus/wrappers/suppressing_argparse.py:20
↓ 3 callers
Function
canonicalize_union
(t: Type)
draccus/utils.py:435
↓ 3 callers
Function
config_type
(new_type: Union[ConfigType, str])
draccus/options.py:31
↓ 3 callers
Function
encode_dataclass
(obj: Any, declared_type: Optional[Type] = None)
draccus/parsers/encoding.py:132
↓ 3 callers
Function
exits_and_writes_to_stderr
(match: str = "")
tests/testutils.py:39
↓ 3 callers
Method
get_choice_class
(cls, name: str)
draccus/choice_types.py:53
↓ 3 callers
Function
has_custom_decoder
(cls: Type[T])
draccus/parsers/decoding.py:222
↓ 3 callers
Function
has_generic_arg
(args)
draccus/utils.py:374
↓ 3 callers
Function
load_config
Load configuration from a stream (file object or string) or file path. Args: stream: Either a file object, string content, or file p
draccus/cfgparsing.py:29
↓ 3 callers
Method
load_config
(stream)
draccus/parsers/config_parsers.py:17
↓ 2 callers
Method
__init_subclass__
(cls, **kwargs)
draccus/choice_types.py:123
↓ 2 callers
Method
_get_metavar_for_action
(self, action: argparse.Action)
draccus/help_formatter.py:80
↓ 2 callers
Function
_is_empty
(line_str: str)
draccus/wrappers/docstring.py:170
↓ 2 callers
Method
_remove_action
(self, action)
draccus/wrappers/suppressing_argparse.py:45
↓ 2 callers
Function
contains_dataclass_type_arg
(t: Type)
draccus/utils.py:234
↓ 2 callers
Function
decode_dataclass
(cls: Type[Dataclass], d: Dict[str, Any], path: Sequence[str] = ())
draccus/parsers/decoding.py:125
↓ 2 callers
Function
decode_list
(t: Type[T])
draccus/parsers/decoding.py:412
↓ 2 callers
Function
flatten
(d, parent_key=None, sep=".")
draccus/utils.py:327
↓ 2 callers
Function
format_list_using_brackets
(value_list: List[Any])
tests/testutils.py:147
↓ 2 callers
Function
format_list_using_spaces
(value_list: List[Any])
tests/testutils.py:143
↓ 2 callers
Function
get_metavar
Gets the metavar to be used for that type in help strings. This is crucial when using a `weird` auto-generated parsing functions for things l
draccus/wrappers/field_metavar.py:22
↓ 2 callers
Function
is_enum
(t: Type)
draccus/utils.py:178
↓ 2 callers
Function
is_list
(t: Type)
draccus/utils.py:148
↓ 2 callers
Method
is_list
(self)
draccus/wrappers/field_wrapper.py:296
↓ 2 callers
Function
is_optional
(t: Type)
draccus/utils.py:226
↓ 2 callers
Method
is_tuple
(self)
draccus/wrappers/field_wrapper.py:304
↓ 2 callers
Function
is_tuple_or_list
(t: Type)
draccus/utils.py:188
↓ 2 callers
Method
is_union
(self)
draccus/wrappers/field_wrapper.py:316
↓ 2 callers
Method
lineage
(self)
draccus/wrappers/wrapper.py:31
↓ 2 callers
Method
parse_string
(s)
draccus/parsers/config_parsers.py:12
↓ 2 callers
Function
strip
(string)
tests/conftest.py:48
↓ 1 callers
Function
ContainerClass
()
tests/test_lists.py:29
↓ 1 callers
Method
__init__
(self, *args, **kwargs)
draccus/wrappers/suppressing_argparse.py:16
↓ 1 callers
Method
_assert_no_conflicts
Checks for a field name that conflicts with utils.CONFIG_ARG
draccus/argparsing.py:102
↓ 1 callers
Method
_assert_preferred_help
Checks that `self.prefer_help` is valid.
draccus/argparsing.py:95
↓ 1 callers
Function
_get_class_source
(some_dataclass: Type)
draccus/wrappers/docstring.py:59
↓ 1 callers
Function
_get_comment_at_line
Gets the comment at line `line` in `code_lines`. Arguments: line {int} -- the index of the line in code_lines Returns: str -
draccus/wrappers/docstring.py:178
↓ 1 callers
Function
_get_comment_ending_at_line
(code_lines: List[str], line: int)
draccus/wrappers/docstring.py:215
↓ 1 callers
Function
_get_docstring_starting_at_line
(code_lines: List[str], line: int)
draccus/wrappers/docstring.py:244
↓ 1 callers
Function
_get_inline_comment_at_line
Gets the inline comment at line `line`. Arguments: line {int} -- the index of the line in code_lines Returns: str -- the inl
draccus/wrappers/docstring.py:196
↓ 1 callers
Method
_get_metavar_for_type
(self, t: Type)
draccus/help_formatter.py:83
↓ 1 callers
Function
_is_comment
(line_str: str)
draccus/wrappers/docstring.py:174
↓ 1 callers
Method
_postprocessing
(self, parsed_args: Namespace)
draccus/argparsing.py:151
↓ 1 callers
Method
_resolve_fully_qualified_name
(cls, name: str)
draccus/choice_types.py:250
↓ 1 callers
Method
_set_dataclass
Adds command-line arguments for the fields of `dataclass`.
draccus/argparsing.py:81
↓ 1 callers
Function
_wrap_field
( parent: Optional[Wrapper], field: dataclasses.Field, preferred_help: str = docstring.HelpOrder.i
draccus/wrappers/dataclass_wrapper.py:167
↓ 1 callers
Method
add_action
(self, parser)
draccus/wrappers/field_wrapper.py:332
↓ 1 callers
Function
apply_type_map
Recursively replaces TypeVars in container types like List[T], Dict[K, V]
draccus/parsers/decoding.py:81
↓ 1 callers
Function
decode_dict
Creates a decoding function for a dict type. Works with OrderedDict too.
draccus/parsers/decoding.py:470
↓ 1 callers
Function
decode_set
Makes a parsing function for creating sets with items of type `item_type`.
draccus/parsers/decoding.py:459
↓ 1 callers
Function
decode_tuple
Makes a parsing function for creating tuples.
draccus/parsers/decoding.py:425
↓ 1 callers
Function
decode_union
(*types: Type[T])
draccus/parsers/decoding.py:358
↓ 1 callers
Method
default_choice_name
Returns the name of the default subclass of this choice type.
draccus/choice_types.py:66
↓ 1 callers
Function
deflatten
(d: Dict[str, Any], sep: str = ".")
draccus/utils.py:338
↓ 1 callers
Function
encode_choice
Encodes an object as a choice type based on its declared type. Args: obj: The object to encode declared_type: The type annotation
draccus/parsers/encoding.py:166
↓ 1 callers
Method
field
(self)
draccus/wrappers/wrapper.py:71
↓ 1 callers
Function
format_error
(e: Exception)
draccus/utils.py:360
↓ 1 callers
Function
format_list_using_double_quotes
(value_list: List[Any])
tests/testutils.py:155
↓ 1 callers
Function
format_list_using_single_quotes
(value_list: List[Any])
tests/testutils.py:151
↓ 1 callers
Function
function_with_draccus_wrap
(cfg: TrainConfig)
tests/test_calling_using_dataclass.py:15
↓ 1 callers
Method
get_arg_options
Create the `parser.add_arguments` kwargs for this field.
draccus/wrappers/field_wrapper.py:98
↓ 1 callers
Function
get_item_type
Returns the `type` of the items in the provided container `type`. When no type annotation is found, or no item type is found, returns `typing
draccus/utils.py:105
↓ 1 callers
Method
get_known_choices
(cls)
draccus/choice_types.py:56
↓ 1 callers
Function
is_dataclass_attr_line
(line: str)
draccus/wrappers/docstring.py:140
↓ 1 callers
Function
is_dict
(t: Type)
draccus/utils.py:156
↓ 1 callers
Method
is_enum
(self)
draccus/wrappers/field_wrapper.py:300
↓ 1 callers
Function
is_generic_arg
(arg)
draccus/utils.py:367
↓ 1 callers
Function
is_literal
Returns True if t is a Literal type.
draccus/utils.py:202
↓ 1 callers
Function
is_set
(t: Type)
draccus/utils.py:161
↓ 1 callers
Function
is_tuple_or_list_of_dataclasses
(t: Type)
draccus/utils.py:230
↓ 1 callers
Function
main
(cfg: TrainConfig)
examples/choice_class_demo.py:74
↓ 1 callers
Function
main
(cfg: TrainConfig)
examples/demo.py:55
↓ 1 callers
Function
only_keep_action_args
Remove all the arguments in `options` that aren't required by the Action. Parameters ---------- options : Dict[str, Any] A dictio
draccus/wrappers/field_wrapper.py:336
next →
1–100 of 407, ranked by callers