Пример #1
0
def get_track_id(path):
    """Generate a UUID based on the path of a track (case sensitive).

    :param unicode path: Absolute path to a track
    :return: UUID based on the path of the track
    :rtype: uuid.UUID
    """
    return uuid.uuid5(NS_TRACKS, to_uuid_input(path))
Пример #2
0
    def test_id_name_elm_rendered_correctly(self):
        """Ensure UUIDs in IdNameElm objects are rendered correctly."""
        elm = IdNameElm(
            id=uuid.UUID(to_uuid_input('7655e605-6eaa-40d8-a25f-5c6c92a4d31a')),
            name='Test Name')

        encoder = avalon.web.response.AvalonJsonEncoder()
        json = encoder.encode(elm)

        assert json.startswith('{')
        assert json.endswith('}')
        assert '7655e605-6eaa-40d8-a25f-5c6c92a4d31a' in json
        assert 'Test Name' in json
Пример #3
0
def _normalize_no_case(value):
    """Normalize a text type by converting it to lower case and
    then converting to the correct type to be used as UUID input
    (varies depending on the version of Python running).
    """
    return to_uuid_input(value.lower())