44``setup.py develop``
55"""
66
7- from __future__ import print_function , unicode_literals
87
98import os
109import re
2524orig = sys .modules [__name__ ]
2625
2726
28- class Git ( object ) :
27+ class Git :
2928
3029 @classmethod
3130 def get_branch (cls , path ):
@@ -53,7 +52,7 @@ def get_version(cls, path, memo={}):
5352 v = re .search ("-[0-9]+-" , memo [path ])
5453 if v is not None :
5554 # Replace -n- with -branchname-n-
56- branch = r "-{0}-\1-" . format ( cls .get_branch (path ))
55+ branch = fr "-{ cls .get_branch (path )} -\1-"
5756 (memo [path ], _ ) = re .subn ("-([0-9]+)-" , branch , memo [path ], 1 )
5857
5958 return memo [path ]
@@ -93,7 +92,7 @@ def getversion(package):
9392 """
9493 distribution = get_distribution (package )
9594 if distribution is None :
96- raise RuntimeError ("Can't find distribution {0}" . format ( package ) )
95+ raise RuntimeError (f "Can't find distribution { package } " )
9796 repo_type = get_repo_type (distribution .location )
9897 if repo_type is None :
9998 return distribution .version
@@ -113,7 +112,7 @@ def version_from_frame(frame):
113112
114113 module_name = module .__name__
115114
116- variable = "AUTOVERSION_{}" . format ( module_name .upper ())
115+ variable = f "AUTOVERSION_{ module_name .upper ()} "
117116 override = os .environ .get (variable , None )
118117 if override is not None :
119118 return override
@@ -161,7 +160,7 @@ def tupleize_version(version):
161160 if version .startswith ("<unknown" ):
162161 return (("unknown" ,),)
163162
164- split = re .split ("(?:\.|(-))" , version )
163+ split = re .split (r "(?:\.|(-))" , version )
165164 parsed = tuple (try_fix_num (x ) for x in split if x )
166165
167166 # Put the tuples in groups by "-"
0 commit comments