Skip to content

Commit

Permalink
Destroy get_role_class in formats.py (not needed)
Browse files Browse the repository at this point in the history
It pertains to now-deleted metadata classes.

Signed-off-by: Sebastien Awwad <sebastien.awwad@gmail.com>
  • Loading branch information
awwad committed Mar 29, 2019
1 parent fca2712 commit ce21d8d
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions tuf/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,52 +828,6 @@ def make_role_metadata(keyids, threshold, name=None, paths=None,



def get_role_class(expected_rolename):
"""
<Purpose>
Return the role class corresponding to
'expected_rolename'. The role name returned
by expected_meta_rolename() should be the name
passed as an argument to this function. If
'expected_rolename' is 'Root', the class
RootFile is returned.
<Arguments>
expected_rolename:
The role name used to determine which role class
to return.
<Exceptions>
securesystemslib.exceptions.FormatError, if 'expected_rolename' is not a
supported role.
<Side Effects>
None.
<Returns>
The class corresponding to 'expected_rolename'.
E.g., 'Snapshot' as an argument to this function causes
SnapshotFile' to be returned.
"""

# Does 'expected_rolename' have the correct type?
# This check ensures 'expected_rolename' conforms to
# 'securesystemslib.formats.NAME_SCHEMA'.
# Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch.
securesystemslib.formats.NAME_SCHEMA.check_match(expected_rolename)

try:
role_class = ROLE_CLASSES_BY_TYPE[expected_rolename]

except KeyError:
raise securesystemslib.exceptions.FormatError(repr(expected_rolename) + ' '
'not supported.')

else:
return role_class



def expected_meta_rolename(meta_rolename):
"""
<Purpose>
Expand Down

0 comments on commit ce21d8d

Please sign in to comment.