:py:mod:`wandb_utils.commands.common` ===================================== .. py:module:: wandb_utils.commands.common Module Contents --------------- .. py:data:: F .. py:class:: Metric(name: str, maximum: bool = True) Bases: :py:obj:`object` .. py:class:: MetricParamType Bases: :py:obj:`click.ParamType` Represents the type of a parameter. Validates and converts values from the command line or Python into the correct type. To implement a custom type, subclass and implement at least the following: - The :attr:`name` class attribute must be set. - Calling an instance of the type with ``None`` must return ``None``. This is already implemented by default. - :meth:`convert` must convert string values to the correct type. - :meth:`convert` must accept values that are already the correct type. - It must be able to convert a value if the ``ctx`` and ``param`` arguments are ``None``. This can occur when converting prompt input. .. py:attribute:: name :annotation: = metric .. py:attribute:: is_composite :annotation: :ClassVar[bool] = False .. py:attribute:: arity :annotation: :ClassVar[int] = 1 .. py:attribute:: envvar_list_splitter :annotation: :ClassVar[Optional[str]] .. py:method:: convert(self, value: str, param, ctx) -> Metric Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``. .. py:method:: to_info_dict(self) -> Dict[str, Any] Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionadded:: 8.0 .. py:method:: get_metavar(self, param: click.core.Parameter) -> Optional[str] Returns the metavar default for this param if it provides one. .. py:method:: get_missing_message(self, param: click.core.Parameter) -> Optional[str] Optionally might return extra information about a missing parameter. .. versionadded:: 2.0 .. py:method:: split_envvar_value(self, rv: str) -> Sequence[str] Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter. If the splitter is set to `None`, which means that whitespace splits, then leading and trailing whitespace is ignored. Otherwise, leading and trailing splitters usually lead to empty items being included. .. py:method:: fail(self, message: str, param: Optional[click.core.Parameter] = None, ctx: Optional[click.core.Context] = None) -> NoReturn Helper method to fail with an invalid value message. .. py:method:: shell_complete(self, ctx: click.core.Context, param: click.core.Parameter, incomplete: str) -> List[click.shell_completion.CompletionItem] Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0 .. py:class:: DictParamType Bases: :py:obj:`click.ParamType` Represents the type of a parameter. Validates and converts values from the command line or Python into the correct type. To implement a custom type, subclass and implement at least the following: - The :attr:`name` class attribute must be set. - Calling an instance of the type with ``None`` must return ``None``. This is already implemented by default. - :meth:`convert` must convert string values to the correct type. - :meth:`convert` must accept values that are already the correct type. - It must be able to convert a value if the ``ctx`` and ``param`` arguments are ``None``. This can occur when converting prompt input. .. py:attribute:: name :annotation: = dict .. py:attribute:: is_composite :annotation: :ClassVar[bool] = False .. py:attribute:: arity :annotation: :ClassVar[int] = 1 .. py:attribute:: envvar_list_splitter :annotation: :ClassVar[Optional[str]] .. py:method:: convert(self, value: str, param, ctx) -> Metric Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``. .. py:method:: to_info_dict(self) -> Dict[str, Any] Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionadded:: 8.0 .. py:method:: get_metavar(self, param: click.core.Parameter) -> Optional[str] Returns the metavar default for this param if it provides one. .. py:method:: get_missing_message(self, param: click.core.Parameter) -> Optional[str] Optionally might return extra information about a missing parameter. .. versionadded:: 2.0 .. py:method:: split_envvar_value(self, rv: str) -> Sequence[str] Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter. If the splitter is set to `None`, which means that whitespace splits, then leading and trailing whitespace is ignored. Otherwise, leading and trailing splitters usually lead to empty items being included. .. py:method:: fail(self, message: str, param: Optional[click.core.Parameter] = None, ctx: Optional[click.core.Context] = None) -> NoReturn Helper method to fail with an invalid value message. .. py:method:: shell_complete(self, ctx: click.core.Context, param: click.core.Parameter, incomplete: str) -> List[click.shell_completion.CompletionItem] Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0 .. py:class:: ListParamType(sep: str = '|') Bases: :py:obj:`click.ParamType` Represents the type of a parameter. Validates and converts values from the command line or Python into the correct type. To implement a custom type, subclass and implement at least the following: - The :attr:`name` class attribute must be set. - Calling an instance of the type with ``None`` must return ``None``. This is already implemented by default. - :meth:`convert` must convert string values to the correct type. - :meth:`convert` must accept values that are already the correct type. - It must be able to convert a value if the ``ctx`` and ``param`` arguments are ``None``. This can occur when converting prompt input. .. py:attribute:: name :annotation: = list .. py:attribute:: is_composite :annotation: :ClassVar[bool] = False .. py:attribute:: arity :annotation: :ClassVar[int] = 1 .. py:attribute:: envvar_list_splitter :annotation: :ClassVar[Optional[str]] .. py:method:: convert(self, value: str, param, ctx) -> List[str] Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``. .. py:method:: to_info_dict(self) -> Dict[str, Any] Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionadded:: 8.0 .. py:method:: get_metavar(self, param: click.core.Parameter) -> Optional[str] Returns the metavar default for this param if it provides one. .. py:method:: get_missing_message(self, param: click.core.Parameter) -> Optional[str] Optionally might return extra information about a missing parameter. .. versionadded:: 2.0 .. py:method:: split_envvar_value(self, rv: str) -> Sequence[str] Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter. If the splitter is set to `None`, which means that whitespace splits, then leading and trailing whitespace is ignored. Otherwise, leading and trailing splitters usually lead to empty items being included. .. py:method:: fail(self, message: str, param: Optional[click.core.Parameter] = None, ctx: Optional[click.core.Context] = None) -> NoReturn Helper method to fail with an invalid value message. .. py:method:: shell_complete(self, ctx: click.core.Context, param: click.core.Parameter, incomplete: str) -> List[click.shell_completion.CompletionItem] Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0 .. py:data:: METRIC .. py:data:: DICT .. py:data:: LIST .. py:class:: WandbAPIWrapper(entity: str = None, project: str = None, sweep: str = None) Bases: :py:obj:`object` Contains an instance of `wandb.Api` or `wandb.PublicApi` and some other information. .. py:data:: pass_api_wrapper .. py:function:: pass_api_and_info(f: F) -> F Code adopted from `click.make_pass_decorator`. Instead of passing an instance of `WandbAPIWrapper`, it passes the following args: api: wandb.Api entity: Optional[str], project: Optional[str], sweep: Optional[str] .. py:function:: processor(f: Callable) Helper decorator to rewrite a function so that it returns another function from it. .. py:function:: apply_decorators(decorators) .. py:class:: FileFilter Bases: :py:obj:`object` .. py:class:: GlobBasedFileFilter(include_filter: Optional[List[str]] = None, exclude_filter: Optional[List[str]] = None) Bases: :py:obj:`FileFilter` .. py:method:: match(self, path: Union[pathlib.Path, pathlib.PurePath], globs: List[str]) -> bool .. py:class:: RunFilter Bases: :py:obj:`object` .. py:class:: NameBasedRunFilter(not_allowed_names: Optional[List[str]] = None, allowed_names: Optional[List[str]] = None) Bases: :py:obj:`RunFilter`