Skip to content

pink.address

Address(path)

Complete address of a Version.

It includes upstream hierarchy as well as task and author, and provides some useful helpers.

The address is found by inspecting a given path. The inspection scope is the currently logged-in's active project.

Parameters:

Name Type Description Default
path str

Path to be matched to a Bip version from the current active project.

required

Attributes:

Name Type Description
path str

Provided path.

project Project

Project owning the version.

item Item

Item owning the version.

document Document

Document owning the version.

version Version

Version found matching the given path.

task Task

Task linked to the found version's document, if any.

author User

User who created the version.

is_tracked bool

If True, the given path has been

is_owned bool

If True, the currently logged-in

is_latest bool

If True, the found version is the

Source code in client/bip/pink/address.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def __init__(self, path: str):
    self.path = path

    self._current_user = link.user.get_current()

    # Related entities
    self.project = self._current_user.get_active_project()
    self.item = None
    self.document = None
    self.version = None
    self.task = None
    self.author = None

    # Helpers
    self.is_tracked = False
    self.is_owned = False
    self.is_latest = False

    self._inspect()

get(path)

Get a version's address from a path.

Attempt to extract the address of a version if the given path matches an existing version found in the currently logged-in user's active project.

Parameters:

Name Type Description Default
path str

Path to the version to find.

required

Returns:

Name Type Description
Address

Address object.

Source code in client/bip/pink/address.py
78
79
80
81
82
83
84
85
86
87
88
89
90
91
def get(path: str):
    """Get a version's address from a path.

    Attempt to extract the address of a version if the
    given path matches an existing version found
    in the currently logged-in user's active project.

    Args:
        path (str): Path to the version to find.

    Returns:
        Address: Address object.
    """
    return Address(path)

get_from_host(host)

Get a version's address from a Host's currently opened file.

This function is a shortcut to the get() function which takes a path as an argument.

Parameters:

Name Type Description Default
host Host

Host plugin.

required

Returns:

Name Type Description
Address

Address object.

Source code in client/bip/pink/address.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
def get_from_host(host):
    """Get a version's address from a Host's currently opened file.

    This function is a shortcut to the get() function which
    takes a path as an argument.

    Args:
        host (Host): Host plugin.

    Returns:
        Address: Address object.
    """
    path = host.path
    return get(path)