MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / reformat_version_sequence

Function reformat_version_sequence

configure.py:844–864  ·  view source on GitHub ↗

Reformat the version string to have the given number of sequences. For example: Given (7, 2) -> 7.0 (7.0.1, 2) -> 7.0 (5, 1) -> 5 (5.0.3.2, 1) -> 5 Args: version_str: String, the version string. sequence_count: int, an integer. Returns: string, re

(version_str, sequence_count)

Source from the content-addressed store, hash-verified

842
843
844def reformat_version_sequence(version_str, sequence_count):
845 """Reformat the version string to have the given number of sequences.
846
847 For example:
848 Given (7, 2) -> 7.0
849 (7.0.1, 2) -> 7.0
850 (5, 1) -> 5
851 (5.0.3.2, 1) -> 5
852
853 Args:
854 version_str: String, the version string.
855 sequence_count: int, an integer.
856
857 Returns:
858 string, reformatted version string.
859 """
860 v = version_str.split('.')
861 if len(v) < sequence_count:
862 v = v + (['0'] * (sequence_count - len(v)))
863
864 return '.'.join(v[:sequence_count])
865
866
867def set_tf_cuda_paths(environ_cp):

Callers

nothing calls this directly

Calls 2

splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected