MCPcopy Create free account

hub / github.com/marin-community/draccus / functions

Functions407 in github.com/marin-community/draccus

↓ 113 callersMethodsetup
Basic setup for a tests. Keyword Arguments: arguments {Optional[str]} -- The arguments to pass to the parser (default: {""})
tests/testutils.py:86
↓ 58 callersFunctionfield
( *, default=dataclasses.MISSING, default_factory=dataclasses.MISSING, init=True, repr=Tru
draccus/fields.py:8
↓ 50 callersFunctionencode
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 callersFunctiondecode
(cls: Type[T], raw_value: Any)
draccus/parsers/decoding.py:64
↓ 15 callersMethodget_help_text
(cls, flag="--help")
tests/testutils.py:110
↓ 14 callersFunctionget_type_arguments
(container_type: Type)
draccus/utils.py:265
↓ 12 callersFunctionparse
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 callersFunctionget_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 callersFunctionraises
(exception=ParsingError, match=None, code: Optional[int] = None)
tests/testutils.py:33
↓ 9 callersFunctionget_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 callersFunctionis_union
(t: Type)
draccus/utils.py:192
↓ 7 callersFunction_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 callersMethodadd_argument
(self, *args, **kwargs)
draccus/wrappers/suppressing_argparse.py:36
↓ 6 callersFunction_mro
(t: Type)
draccus/utils.py:134
↓ 6 callersMethodregister_subclass
(cls, name: str, choice_type: Type)
draccus/choice_types.py:97
↓ 6 callersFunctionstringify_type
(tpe: Type)
draccus/utils.py:462
↓ 5 callersMethodget_config_type
()
draccus/options.py:26
↓ 5 callersFunctionget_preferred_help_text
(doc: AttributeDocString, preferred_help: str = HelpOrder.inline)
draccus/wrappers/docstring.py:46
↓ 5 callersFunctionis_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 callersMethod__init__
(self, *args, **kwargs)
draccus/parsers/yaml_loader.py:79
↓ 4 callersFunctionget_args
(some_type: Type)
draccus/utils.py:44
↓ 4 callersMethodget_choice_name
Returns the name of the given subclass of this choice type.
draccus/choice_types.py:59
↓ 4 callersFunctionis_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 callersFunctionis_tuple
(t: Type)
draccus/utils.py:152
↓ 4 callersMethodset_config_type
(new_type: Union[ConfigType, str])
draccus/options.py:20
↓ 3 callersFunctionTaskHyperParameters
Test fixture that gives a good example use-case from a real datascience project.
tests/conftest.py:101
↓ 3 callersMethod_discover_packages
(cls)
draccus/choice_types.py:193
↓ 3 callersMethodadd_argument_group
(self, *args, **kwargs)
draccus/wrappers/suppressing_argparse.py:20
↓ 3 callersFunctioncanonicalize_union
(t: Type)
draccus/utils.py:435
↓ 3 callersFunctionconfig_type
(new_type: Union[ConfigType, str])
draccus/options.py:31
↓ 3 callersFunctionencode_dataclass
(obj: Any, declared_type: Optional[Type] = None)
draccus/parsers/encoding.py:132
↓ 3 callersFunctionexits_and_writes_to_stderr
(match: str = "")
tests/testutils.py:39
↓ 3 callersMethodget_choice_class
(cls, name: str)
draccus/choice_types.py:53
↓ 3 callersFunctionhas_custom_decoder
(cls: Type[T])
draccus/parsers/decoding.py:222
↓ 3 callersFunctionhas_generic_arg
(args)
draccus/utils.py:374
↓ 3 callersFunctionload_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 callersMethodload_config
(stream)
draccus/parsers/config_parsers.py:17
↓ 2 callersMethod__init_subclass__
(cls, **kwargs)
draccus/choice_types.py:123
↓ 2 callersMethod_get_metavar_for_action
(self, action: argparse.Action)
draccus/help_formatter.py:80
↓ 2 callersFunction_is_empty
(line_str: str)
draccus/wrappers/docstring.py:170
↓ 2 callersMethod_remove_action
(self, action)
draccus/wrappers/suppressing_argparse.py:45
↓ 2 callersFunctioncontains_dataclass_type_arg
(t: Type)
draccus/utils.py:234
↓ 2 callersFunctiondecode_dataclass
(cls: Type[Dataclass], d: Dict[str, Any], path: Sequence[str] = ())
draccus/parsers/decoding.py:125
↓ 2 callersFunctiondecode_list
(t: Type[T])
draccus/parsers/decoding.py:412
↓ 2 callersFunctionflatten
(d, parent_key=None, sep=".")
draccus/utils.py:327
↓ 2 callersFunctionformat_list_using_brackets
(value_list: List[Any])
tests/testutils.py:147
↓ 2 callersFunctionformat_list_using_spaces
(value_list: List[Any])
tests/testutils.py:143
↓ 2 callersFunctionget_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 callersFunctionis_enum
(t: Type)
draccus/utils.py:178
↓ 2 callersFunctionis_list
(t: Type)
draccus/utils.py:148
↓ 2 callersMethodis_list
(self)
draccus/wrappers/field_wrapper.py:296
↓ 2 callersFunctionis_optional
(t: Type)
draccus/utils.py:226
↓ 2 callersMethodis_tuple
(self)
draccus/wrappers/field_wrapper.py:304
↓ 2 callersFunctionis_tuple_or_list
(t: Type)
draccus/utils.py:188
↓ 2 callersMethodis_union
(self)
draccus/wrappers/field_wrapper.py:316
↓ 2 callersMethodlineage
(self)
draccus/wrappers/wrapper.py:31
↓ 2 callersMethodparse_string
(s)
draccus/parsers/config_parsers.py:12
↓ 2 callersFunctionstrip
(string)
tests/conftest.py:48
↓ 1 callersFunctionContainerClass
()
tests/test_lists.py:29
↓ 1 callersMethod__init__
(self, *args, **kwargs)
draccus/wrappers/suppressing_argparse.py:16
↓ 1 callersMethod_assert_no_conflicts
Checks for a field name that conflicts with utils.CONFIG_ARG
draccus/argparsing.py:102
↓ 1 callersMethod_assert_preferred_help
Checks that `self.prefer_help` is valid.
draccus/argparsing.py:95
↓ 1 callersFunction_get_class_source
(some_dataclass: Type)
draccus/wrappers/docstring.py:59
↓ 1 callersFunction_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 callersFunction_get_comment_ending_at_line
(code_lines: List[str], line: int)
draccus/wrappers/docstring.py:215
↓ 1 callersFunction_get_docstring_starting_at_line
(code_lines: List[str], line: int)
draccus/wrappers/docstring.py:244
↓ 1 callersFunction_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 callersMethod_get_metavar_for_type
(self, t: Type)
draccus/help_formatter.py:83
↓ 1 callersFunction_is_comment
(line_str: str)
draccus/wrappers/docstring.py:174
↓ 1 callersMethod_postprocessing
(self, parsed_args: Namespace)
draccus/argparsing.py:151
↓ 1 callersMethod_resolve_fully_qualified_name
(cls, name: str)
draccus/choice_types.py:250
↓ 1 callersMethod_set_dataclass
Adds command-line arguments for the fields of `dataclass`.
draccus/argparsing.py:81
↓ 1 callersFunction_wrap_field
( parent: Optional[Wrapper], field: dataclasses.Field, preferred_help: str = docstring.HelpOrder.i
draccus/wrappers/dataclass_wrapper.py:167
↓ 1 callersMethodadd_action
(self, parser)
draccus/wrappers/field_wrapper.py:332
↓ 1 callersFunctionapply_type_map
Recursively replaces TypeVars in container types like List[T], Dict[K, V]
draccus/parsers/decoding.py:81
↓ 1 callersFunctiondecode_dict
Creates a decoding function for a dict type. Works with OrderedDict too.
draccus/parsers/decoding.py:470
↓ 1 callersFunctiondecode_set
Makes a parsing function for creating sets with items of type `item_type`.
draccus/parsers/decoding.py:459
↓ 1 callersFunctiondecode_tuple
Makes a parsing function for creating tuples.
draccus/parsers/decoding.py:425
↓ 1 callersFunctiondecode_union
(*types: Type[T])
draccus/parsers/decoding.py:358
↓ 1 callersMethoddefault_choice_name
Returns the name of the default subclass of this choice type.
draccus/choice_types.py:66
↓ 1 callersFunctiondeflatten
(d: Dict[str, Any], sep: str = ".")
draccus/utils.py:338
↓ 1 callersFunctionencode_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 callersMethodfield
(self)
draccus/wrappers/wrapper.py:71
↓ 1 callersFunctionformat_error
(e: Exception)
draccus/utils.py:360
↓ 1 callersFunctionformat_list_using_double_quotes
(value_list: List[Any])
tests/testutils.py:155
↓ 1 callersFunctionformat_list_using_single_quotes
(value_list: List[Any])
tests/testutils.py:151
↓ 1 callersFunctionfunction_with_draccus_wrap
(cfg: TrainConfig)
tests/test_calling_using_dataclass.py:15
↓ 1 callersMethodget_arg_options
Create the `parser.add_arguments` kwargs for this field.
draccus/wrappers/field_wrapper.py:98
↓ 1 callersFunctionget_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 callersMethodget_known_choices
(cls)
draccus/choice_types.py:56
↓ 1 callersFunctionis_dataclass_attr_line
(line: str)
draccus/wrappers/docstring.py:140
↓ 1 callersFunctionis_dict
(t: Type)
draccus/utils.py:156
↓ 1 callersMethodis_enum
(self)
draccus/wrappers/field_wrapper.py:300
↓ 1 callersFunctionis_generic_arg
(arg)
draccus/utils.py:367
↓ 1 callersFunctionis_literal
Returns True if t is a Literal type.
draccus/utils.py:202
↓ 1 callersFunctionis_set
(t: Type)
draccus/utils.py:161
↓ 1 callersFunctionis_tuple_or_list_of_dataclasses
(t: Type)
draccus/utils.py:230
↓ 1 callersFunctionmain
(cfg: TrainConfig)
examples/choice_class_demo.py:74
↓ 1 callersFunctionmain
(cfg: TrainConfig)
examples/demo.py:55
↓ 1 callersFunctiononly_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