Skip to content

Commit

Permalink
Unify data classes
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Sep 6, 2024
1 parent cdacd95 commit 109fed3
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 234 deletions.
37 changes: 9 additions & 28 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import pep610
dist = metadata.distribution("pep610")

match data := pep610.read_from_distribution(dist):
case pep610.DirData(url, pep610.DirInfo(editable=True)):
case pep610.DirectUrl(url, pep610.DirInfo(editable=True)):
print("Editable installation, a.k.a. in development mode")
case _:
print("Not an editable installation")
Expand All @@ -34,8 +34,9 @@ dist = metadata.distribution("pep610")

if (
(data := pep610.read_from_distribution(dist))
and isinstance(data, pep610.DirData)
and data.dir_info.is_editable()
and isinstance(data, pep610.DirectUrl)
and isinstance(data.info, pep610.DirInfo)
and data.info.is_editable()
):
print("Editable installation, a.k.a. in development mode")
else:
Expand Down Expand Up @@ -74,24 +75,14 @@ for package in report["install"]:
print(data)
```

## Supported formats
## Direct URL Data class

```{eval-rst}
.. autoclass:: pep610.ArchiveData
.. autoclass:: pep610.DirectUrl
:members:
```

```{eval-rst}
.. autoclass:: pep610.DirData
:members:
```

```{eval-rst}
.. autoclass:: pep610.VCSData
:members:
```

## Other classes
## Supported direct URL formats

```{eval-rst}
.. autoclass:: pep610.ArchiveInfo
Expand Down Expand Up @@ -135,27 +126,17 @@ for package in report["install"]:
:members: hashes, hash
```

```{eval-rst}
.. autoclass:: pep610._types.ArchiveDict
:members: url, archive_info
```

```{eval-rst}
.. autoclass:: pep610._types.DirectoryInfoDict
:members: editable
```

```{eval-rst}
.. autoclass:: pep610._types.DirectoryDict
:members: url, dir_info
```

```{eval-rst}
.. autoclass:: pep610._types.VCSInfoDict
:members: vcs, commit_id, requested_revision, resolved_revision, resolved_revision_type
```

```{eval-rst}
.. autoclass:: pep610._types.VCSDict
:members: url ,vcs_info
.. autoclass:: pep610._types.DirectUrlDict
:members: url, vcs_info, archive_info, dir_info
```
Loading

0 comments on commit 109fed3

Please sign in to comment.