1515
1616def _exec (cmd ): # type: (str) -> List[str]
1717 try :
18- stdout = subprocess .check_output (
19- cmd , shell = True , universal_newlines = True # nosec
20- )
18+ stdout = subprocess .check_output (cmd , shell = True , universal_newlines = True ) # nosec
2119 except subprocess .CalledProcessError as e :
2220 stdout = e .output
2321 lines = stdout .splitlines ()
@@ -64,14 +62,14 @@ def get_tag(): # type: () -> Optional[str]
6462
6563
6664def get_sha (name = "HEAD" ): # type: (str) -> Optional[str]
67- sha = _exec (f 'git rev-list -n 1 "{ name } "' )
65+ sha = _exec ('git rev-list -n 1 "{}"' . format ( name ) )
6866 if sha :
6967 return sha [0 ]
7068 return None
7169
7270
7371def get_latest_file_commit (path ): # type: (str) -> Optional[str]
74- sha = _exec (f 'git log -n 1 --pretty=format:%H -- "{ path } "' )
72+ sha = _exec ('git log -n 1 --pretty=format:%H -- "{}"' . format ( path ) )
7573 if sha :
7674 return sha [0 ]
7775 return None
@@ -85,7 +83,7 @@ def is_dirty(): # type: () -> bool
8583
8684
8785def count_since (name ): # type: (str) -> Optional[int]
88- res = _exec (f 'git rev-list --count HEAD "^{ name } "' )
86+ res = _exec ('git rev-list --count HEAD "^{}"' . format ( name ) )
8987 if res :
9088 return int (res [0 ])
9189 return None
@@ -109,9 +107,7 @@ def parse_config(dist, _, value): # type: (Distribution, Any, Any) -> None
109107 starting_version = value .get ("starting_version" , DEFAULT_STARTING_VERSION )
110108 version_callback = value .get ("version_callback" , None )
111109 version_file = value .get ("version_file" , None )
112- count_commits_from_version_file = value .get (
113- "count_commits_from_version_file" , False
114- )
110+ count_commits_from_version_file = value .get ("count_commits_from_version_file" , False )
115111 branch_formatter = value .get ("branch_formatter" , None )
116112
117113 version = version_from_git (
@@ -191,9 +187,7 @@ def version_from_git(
191187 else :
192188 t = template
193189
194- version = t .format (
195- sha = full_sha [:8 ], tag = tag , ccount = ccount , branch = branch , full_sha = full_sha
196- )
190+ version = t .format (sha = full_sha [:8 ], tag = tag , ccount = ccount , branch = branch , full_sha = full_sha )
197191
198192 # Ensure local version label only contains permitted characters
199193 public , sep , local = version .partition ("+" )
0 commit comments