tensorbay.client.struct

User, Commit, Tag, Branch and Draft classes.

User defines the basic concept of a user with an action.

Commit defines the structure of a commit.

Tag defines the structure of a commit tag.

Branch defines the structure of a branch.

Draft defines the structure of a draft.

class tensorbay.client.struct.TeamInfo(name, *, email=None, description='')[source]

Bases: tensorbay.utility.name.NameMixin

This class defines the basic concept of a TensorBay team.

Parameters
  • name (str) – The name of the team.

  • email (Optional[str]) – The email of the team.

  • description (str) – The description of the team.

Return type

None

classmethod loads(contents)[source]

Loads a TeamInfo instance from the given contents.

Parameters

contents (Dict[str, Any]) –

A dict containing all the information of the commit:

{
    "name": <str>
    "email": <str>
    "description": <str>
}

Returns

A TeamInfo instance containing all the information in the given contents.

Return type

tensorbay.client.struct._T

dumps()[source]

Dumps all the information into a dict.

Returns

A dict containing all the information of the team:

{
        "name": <str>
        "email": <str>
        "description": <str>
}

Return type

Dict[str, Any]

class tensorbay.client.struct.UserInfo(name, *, email=None, mobile=None, description='', team=None)[source]

Bases: tensorbay.utility.name.NameMixin

This class defines the basic concept of a TensorBay user.

Parameters
  • name (str) – The nickname of the user.

  • email (Optional[str]) – The email of the user.

  • mobile (Optional[str]) – The mobile of the user.

  • description (str) – The description of the user.

  • team (Optional[tensorbay.client.struct.TeamInfo]) – The team of the user.

Return type

None

classmethod loads(contents)[source]

Loads a UserInfo instance from the given contents.

Parameters

contents (Dict[str, Any]) –

A dict containing all the information of the commit:

{
    "name": <str>
    "email": <str>
    "mobile": <str>
    "description": <str>
    "team": {  <dict>
        "name": <str>
        "email": <str>
        "description": <str>
    }
}

Returns

A UserInfo instance containing all the information in the given contents.

Return type

tensorbay.client.struct._T

dumps()[source]

Dumps all the information into a dict.

Returns

A dict containing all the information of the user:

{
        "name": <str>
        "email": <str>
        "mobile": <str>
        "description": <str>
        "team": {  <dict>
            "name": <str>
            "email": <str>
            "description": <str>
        }
}

Return type

Dict[str, Any]

class tensorbay.client.struct.User(name, date)[source]

Bases: tensorbay.utility.attr.AttrsMixin, tensorbay.utility.repr.ReprMixin

This class defines the basic concept of a user with an action.

Parameters
  • name (str) – The name of the user.

  • date (int) – The date of the user action.

Return type

None

classmethod loads(contents)[source]

Loads a User instance from the given contents.

Parameters

contents (Dict[str, Any]) –

A dict containing all the information of the commit:

{
    "name": <str>
    "date": <int>
}

Returns

A User instance containing all the information in the given contents.

Return type

tensorbay.client.struct._T

dumps()[source]

Dumps all the user information into a dict.

Returns

A dict containing all the information of the user:

{
    "name": <str>
    "date": <int>
}

Return type

Dict[str, Any]

class tensorbay.client.struct.Commit(commit_id, parent_commit_id, title, description, committer)[source]

Bases: tensorbay.utility.attr.AttrsMixin, tensorbay.utility.repr.ReprMixin

This class defines the structure of a commit.

Parameters
  • commit_id (str) – The commit id.

  • parent_commit_id (Optional[str]) – The parent commit id.

  • title (str) – The commit title.

  • description (str) – The commit description.

  • committer (tensorbay.client.struct.User) – The commit user.

Return type

None

classmethod loads(contents)[source]

Loads a Commit instance for the given contents.

Parameters

contents (Dict[str, Any]) –

A dict containing all the information of the commit:

{
    "commitId": <str>
    "parentCommitId": <str> or None
    "title": <str>
    "description": <str>
    "committer": {
        "name": <str>
        "date": <int>
    }
}

Returns

A Commit instance containing all the information in the given contents.

Return type

tensorbay.client.struct._T

dumps()[source]

Dumps all the commit information into a dict.

Returns

A dict containing all the information of the commit:

{
    "commitId": <str>
    "parentCommitId": <str> or None
    "title": <str>
    "description": <str>
    "committer": {
        "name": <str>
        "date": <int>
    }
}

Return type

Dict[str, Any]

class tensorbay.client.struct.Tag(name, commit_id, parent_commit_id, title, description, committer)[source]

Bases: tensorbay.client.struct._NamedCommit

This class defines the structure of the tag of a commit.

Parameters
  • name (str) – The name of the tag.

  • commit_id (str) – The commit id.

  • parent_commit_id (Optional[str]) – The parent commit id.

  • title (str) – The commit title.

  • description (str) – The commit description.

  • committer (tensorbay.client.struct.User) – The commit user.

Return type

None

class tensorbay.client.struct.Branch(name, commit_id, parent_commit_id, title, description, committer)[source]

Bases: tensorbay.client.struct._NamedCommit

This class defines the structure of a branch.

Parameters
  • name (str) – The name of the branch.

  • commit_id (str) – The commit id.

  • parent_commit_id (Optional[str]) – The parent commit id.

  • title (str) – The commit title.

  • description (str) – The commit description.

  • committer (tensorbay.client.struct.User) – The commit user.

Return type

None

class tensorbay.client.struct.Draft(number, title, branch_name, status, parent_commit_id, author, updated_at, description='')[source]

Bases: tensorbay.utility.attr.AttrsMixin, tensorbay.utility.repr.ReprMixin

This class defines the basic structure of a draft.

Parameters
  • number (int) – The number of the draft.

  • title (str) – The title of the draft.

  • branch_name (str) – The branch name.

  • status (str) – The status of the draft.

  • parent_commit_id (str) – The parent commit id.

  • author (tensorbay.client.struct.User) – The author of the draft.

  • updated_at (int) – The time of last update.

  • description (str) – The draft description.

Return type

None

classmethod loads(contents)[source]

Loads a Draft instance from the given contents.

Parameters

contents (Dict[str, Any]) –

A dict containing all the information of the draft:

{
    "number": <int>
    "title": <str>
    "branchName": <str>
    "status": "OPEN", "CLOSED" or "COMMITTED"
    "parentCommitId": <str>
    "author": {
        "name": <str>
        "date": <int>
    }
    "updatedAt": <int>
    "description": <str>
}

Returns

A Draft instance containing all the information in the given contents.

Return type

tensorbay.client.struct._T

dumps()[source]

Dumps all the information of the draft into a dict.

Returns

A dict containing all the information of the draft:

{
    "number": <int>
    "title": <str>
    "branchName": <str>
    "status": "OPEN", "CLOSED" or "COMMITTED"
    "parentCommitId": <str>
    "author": {
        "name": <str>
        "date": <int>
    }
    "updatedAt": <int>
    "description": <str>
}

Return type

Dict[str, Any]