88from packaging .requirements import Requirement
99
1010
11- def print_color (text :str , color :str = Fore .BLUE ):
11+ def print_color (text : str , color : str = Fore .BLUE ):
1212 """Print colored text specified by color argument based on colorama
13- - default color BLUE
13+ - default color BLUE
1414 """
15- print (f' { color } ' , f' { text } ' , Style .RESET_ALL )
15+ print (f" { color } " , f" { text } " , Style .RESET_ALL )
1616
1717
18- def merge_requirements (requirement :Requirement , another_req :Requirement ) -> Requirement :
18+ def merge_requirements (requirement : Requirement , another_req : Requirement ) -> Requirement :
1919 """Merges two requirements into one requirement."""
20- new_ver_specifier = ''
21- new_markers = ''
20+ new_ver_specifier = ""
21+ new_markers = ""
2222 if requirement .specifier and another_req .specifier :
23- if not another_req .marker and ('==' not in str (requirement .specifier )
24- and '!=' not in str (requirement .specifier )):
25- new_ver_specifier = f'{ requirement .specifier } ,{ another_req .specifier } '
23+ if not another_req .marker and (
24+ "==" not in str (requirement .specifier ) and "!=" not in str (requirement .specifier )
25+ ):
26+ new_ver_specifier = f"{ requirement .specifier } ,{ another_req .specifier } "
2627 else :
2728 new_ver_specifier = another_req .specifier
2829 elif requirement .specifier and not another_req .specifier :
@@ -31,15 +32,15 @@ def merge_requirements(requirement:Requirement, another_req:Requirement) -> Requ
3132 new_ver_specifier = another_req .specifier
3233
3334 if requirement .marker and another_req .marker :
34- new_markers = f' ({ requirement .marker } ) and ({ another_req .marker } )'
35+ new_markers = f" ({ requirement .marker } ) and ({ another_req .marker } )"
3536 elif requirement .marker and not another_req .marker :
3637 new_markers = requirement .marker
3738 elif not requirement .marker and another_req .marker :
3839 new_markers = another_req .marker
3940
4041 # construct new requirement
4142 new_requirement = Requirement (
42- f' { requirement .name } { new_ver_specifier } ' + (f' ; { new_markers } ' if new_markers else '' )
43+ f" { requirement .name } { new_ver_specifier } " + (f" ; { new_markers } " if new_markers else "" )
4344 )
4445
4546 return new_requirement
0 commit comments