swh.web.utils.typing module#

class swh.web.utils.typing.OriginInfo[source]#

Bases: TypedDict

url: str#

URL of the origin

visit_types: List[str]#

Visit types associated to the origin

class swh.web.utils.typing.OriginMetadataInfo[source]#

Bases: dict

metadata: Dict[str, Any]#

Origin metadata associated to the origin

url: str#
visit_types: List[str]#
class swh.web.utils.typing.OriginVisitInfo[source]#

Bases: TypedDict

date: str#

date of the visit in iso format

formatted_date: str#

formatted date of the visit

metadata: Dict[str, Any]#

metadata associated to the visit

origin: str#

visited origin URL

snapshot: str#

snapshot identifier computed during the visit

status: str#

status of the visit (“ongoing”, “full” or “partial”)

type: str#

visit type (git, hg, debian, …)

url: str#

URL to browse the snapshot

visit: int#

visit identifier

class swh.web.utils.typing.SnapshotBranchInfo[source]#

Bases: TypedDict

date: str | None#

“author date of branch heading revision

directory: str | None#

directory associated to branch heading revision

message: str | None#

message of branch heading revision

name: str#

branch name

alias: bool#

define if the branch is an alias

target_type: str#

content, directory or revision

Type:

branch target type

target: str#

branch target id

url: str | None#

optional browse URL (content, directory, …) scoped to branch

class swh.web.utils.typing.SnapshotReleaseInfo[source]#

Bases: TypedDict

branch_name: str#

branch name associated to release in snapshot

date: str#

release date

directory: str | None#

optional directory associated to the release

id: str#

release identifier

message: str#

release message

name: str#

release name

alias: bool#

define if the branch is an alias

target: str#

release target

target_type: str#

release target_type

url: str | None#

optional browse URL (content, directory, …) scoped to release

class swh.web.utils.typing.SnapshotContext[source]#

Bases: TypedDict

branch: str | None#

optional branch name set when browsing snapshot in that scope

branch_alias: bool#

indicates if the focused branch is an alias

branches: List[SnapshotBranchInfo]#

list of snapshot branches (possibly truncated)

branches_url: str#

snapshot branches list browse URL

is_empty: bool#

indicates if the snapshot is empty

origin_info: OriginInfo | None#

optional origin info associated to the snapshot

origin_visits_url: str | None#

optional origin visits URL

query_params: Dict[str, str | None]#

common query parameters when browsing snapshot content

release: str | None#

optional release name set when browsing snapshot in that scope

release_alias: bool#

indicates if the focused release is an alias

release_id: str | None#

optional release identifier set when browsing snapshot in that scope

releases: List[SnapshotReleaseInfo]#

list of snapshot releases (possibly truncated)

releases_url: str#

snapshot releases list browse URL

revision_id: str | None#

optional revision identifier set when browsing snapshot in that scope

revision_info: Dict[str, Any] | None#

optional revision info set when browsing snapshot in that scope

root_directory: str | None#

optional root directory identifier set when browsing snapshot content

snapshot_id: str#

snapshot identifier

snapshot_sizes: Dict[str, int]#

snapshot sizes grouped by branch target type

snapshot_swhid: str#

snapshot SWHID

url_args: Dict[str, Any]#

common URL arguments when browsing snapshot content

visit_info: OriginVisitInfo | None#

optional origin visit info associated to the snapshot

browse_url: str | None#

optional browse URL associated to the snapshot

class swh.web.utils.typing.SWHObjectInfo[source]#

Bases: TypedDict

object_type: ObjectType#
object_id: str | None#
class swh.web.utils.typing.SWHIDContext[source]#

Bases: TypedDict

origin: str#
anchor: str#
visit: str#
path: str#
lines: str#
class swh.web.utils.typing.SWHIDInfo[source]#

Bases: dict

swhid: str#
swhid_url: str#
context: SWHIDContext#
swhid_with_context: str | None#
swhid_with_context_url: str | None#
object_type: ObjectType#
object_id: str | None#
class swh.web.utils.typing.SWHObjectInfoMetadata[source]#

Bases: TypedDict

origin_url: str | None#
visit_date: str | None#
visit_type: str | None#
class swh.web.utils.typing.ContentMetadata[source]#

Bases: dict

sha1: str#
sha1_git: str#
sha256: str#
blake2s256: str#
content_url: str#
mimetype: str#
encoding: str#
size: int#
language: str#
path: str | None#
filename: str | None#
directory: str | None#
root_directory: str | None#
revision: str | None#
release: str | None#
snapshot: str | None#
object_type: ObjectType#
object_id: str | None#
origin_url: str | None#
visit_date: str | None#
visit_type: str | None#
class swh.web.utils.typing.DirectoryMetadata[source]#

Bases: dict

directory: str | None#
nb_files: int | None#
nb_dirs: int | None#
sum_file_sizes: int | None#
root_directory: str | None#
path: str | None#
revision: str | None#
revision_found: bool | None#
release: str | None#
snapshot: str | None#
object_type: ObjectType#
object_id: str | None#
origin_url: str | None#
visit_date: str | None#
visit_type: str | None#
class swh.web.utils.typing.ReleaseMetadata[source]#

Bases: dict

release: str#
author: str#
author_url: str#
date: str#
name: str#
synthetic: bool#
target: str#
target_type: str#
object_type: ObjectType#
object_id: str | None#
origin_url: str | None#
visit_date: str | None#
visit_type: str | None#
snapshot: str | None#
class swh.web.utils.typing.RevisionMetadata[source]#

Bases: dict

object_type: ObjectType#
object_id: str | None#
origin_url: str | None#
visit_date: str | None#
visit_type: str | None#
revision: str#
author: str#
author_url: str#
committer: str#
committer_url: str#
date: str#
committer_date: str#
directory: str#
merge: bool#
metadata: str#
parents: List[str]#
synthetic: bool#
type: str#
snapshot: str | None#
class swh.web.utils.typing.SaveOriginRequestInfo[source]#

Bases: TypedDict

id: int#

Unique key

save_request_date: str#

Date of the creation request

visit_type: str#

Type of the visit

visit_status: str | None#

Status of the visit

origin_url: str#

Origin to ingest

save_request_status: str#

Status of the request

loading_task_id: int | None#

Identifier of the loading task in the scheduler if scheduled

visit_date: str | None#

End of the visit if terminated

save_task_status: str#

Status of the scheduled task

note: str | None#

Optional note associated to the request, for instance rejection reason

from_webhook: bool#

Indicates if request was created from a webhook receiver

webhook_origin: str | None#

Indicates from which forge type a webhook was received

snapshot_swhid: str | None#

SWHID of snapshot associated to the visit

next_run: datetime | None#

Date and time from which the request is executed

class swh.web.utils.typing.OriginExistenceCheckInfo[source]#

Bases: TypedDict

origin_url: str#

Origin to check

exists: bool#

Does the url exist?

content_length: int | None#

content length of the artifact

last_modified: str | None#

Last modification time reported by the server (as iso8601 string)

class swh.web.utils.typing.IntrinsicMetadataFiletype(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

CODEMETA = 'codemeta.json'#
CFF = 'citation.cff'#
class swh.web.utils.typing.IntrinsicMetadataFile[source]#

Bases: TypedDict

type: IntrinsicMetadataFiletype#

Intrinsic metadata file type

name: str#

Intrinsic metadata file name

id: str#

Intrinsic metadata file id (sha1 git)

content: dict[str, Any]#

Intrinsic metadata file content

parsing_error: str | None#

Error message indicating why metadata could not be parsed

class swh.web.utils.typing.Citation[source]#

Bases: TypedDict

format: str#

Citation format (currently bibtex)

content: str#

Formatted citation string content

source_swhid: str#

Qualified SWHID of citation metadata source file

error: str | None#

Error message indicating why citation could not be generated