define.param.groups¶
group(cls=None, *, exclude=None, **kwargs)
¶
Construct a Parameter group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls |
T
|
The class to make into a parameter group |
None
|
exclude |
t.Sequence[str] | None
|
List of type to exclude from the parameter list. Useful if you assign values to the class instance at runtime, but still want to annotate them in your type hints |
None
|
Returns:
Name | Type | Description |
---|---|---|
type |
T | t.Callable[[T], T]
|
The modified class |
Example:
import arc
@arc.group
class MyGroup():
name: str
@arc.command
def command(group: MyGroup):
print(group.name)
command("Sean")
Source code in /home/runner/work/arc/arc/arc/define/param/groups.py
groupoptions(cls)
¶
Returns a dictionary representing the options passed
in when a parameter group was created. Should be used
in conjuction with isgroup()
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls |
type
|
Parameter Group Class |
required |
Raises:
Type | Description |
---|---|
TypeError
|
If the passed in type is not a parameter group |
Returns:
Name | Type | Description |
---|---|---|
ParamGroupOptions |
at.ParamGroupOptions
|
The options dictionary |
Source code in /home/runner/work/arc/arc/arc/define/param/groups.py
isgroup(cls)
¶
Returns a boolean whether or not a given type is an arc parameter group