# methodcard.registry

*module*

The registry of every method card, filled on import and keyed by qualified name.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L1-L1)

## methodcard.registry.Entry

*class* · *dataclass*

```python
class Entry
```

A registered method: the object, its card and what only exists at runtime.

**Attributes**

- `obj` (`Any`) — The class or function.
- `card` (`MethodCard`) — Its card.
- `symbolic` (`Mapping[str, Any] | Callable[[], Mapping[str, Any]]`) — SymPy rules by equation key (:class:`~methodcard.Rule` or bare expressions), or a function returning them.
- `problem` (`Callable[[], Any] | None`) — Returns the :class:`~methodcard.ConvergenceProblem` of the method.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L14-L40)

### methodcard.registry.Entry.card

*attribute* · *instance attribute*

```python
card: MethodCard
```

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L27-L27)

### methodcard.registry.Entry.obj

*attribute* · *instance attribute*

```python
obj: Any
```

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L26-L26)

### methodcard.registry.Entry.problem

*attribute* · *class attribute* · *instance attribute*

```python
problem: Callable[[], Any] | None = None
```

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L31-L31)

### methodcard.registry.Entry.symbolic

*attribute* · *class attribute* · *instance attribute*

```python
symbolic: Mapping[str, Any] | Callable[[], Mapping[str, Any]] = field(default_factory=dict)
```

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L28-L30)

### methodcard.registry.Entry.package

*property*

```python
package: str
```

The top-level package the method belongs to.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L38-L40)

### methodcard.registry.Entry.rules

*method*

```python
def rules() -> Mapping[str, Any]
```

The SymPy rules, calling the function that returns them if need be.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L33-L35)

## methodcard.registry.card

*function*

```python
def card(obj: Any) -> MethodCard
```

The card of a registered class or function (it renders in Jupyter).

**Raises**

- `LookupError` — If the object has no card.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L83-L92)

## methodcard.registry.entries

*function*

```python
def entries(package: str | None = None) -> dict[str, Entry]
```

The registered entries, of one top-level package or of all.

**Parameters**

- `package` (`str | None`) (default: `None`) — The top-level package, e.g. ``"freeofcharge"``; ``None`` for all.

**Returns**

- (`dict[str, Entry]`) — A copy of the registry, ``{qualified name: entry}``.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L62-L75)

## methodcard.registry.load

*function*

```python
def load(package: str) -> dict[str, BaseException]
```

Import a package and all its submodules, so that every card is registered.

Modules in a ``tests`` subpackage are skipped.

**Parameters**

- `package` (`str`) — The top-level package.

**Returns**

- (`dict[str, BaseException]`) — The modules that failed to import, with their errors.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L95-L124)

## methodcard.registry.qualified_name

*function*

```python
def qualified_name(obj: Any) -> str
```

``<module>.<qualname>`` of a class or function.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L46-L48)

## methodcard.registry.register

*function*

```python
def register(entry: Entry) -> None
```

Add an entry; a name registered twice (a module reloaded) is replaced.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L57-L59)

## methodcard.registry.registry

*function*

```python
def registry(package: str | None = None) -> dict[str, Any]
```

The registered classes and functions, of one top-level package or of all.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L78-L80)

## methodcard.registry.summary

*function*

```python
def summary(obj: Any) -> str
```

The first line of the object's own docstring.

[View source](https://github.com/max-models/methodcard/blob/devel/src/methodcard/registry.py#L51-L54)
