19
19
from requests .models import Response
20
20
from requests .adapters import HTTPAdapter
21
21
22
- from good_first_issues .graphql .queries import org_query , repo_query , user_query , search_query
22
+ from good_first_issues .graphql .queries import (
23
+ org_query ,
24
+ repo_query ,
25
+ user_query ,
26
+ search_query ,
27
+ )
23
28
24
29
25
30
# Initializations
@@ -111,14 +116,13 @@ def extract_repo_issues(
111
116
112
117
return issues , rate_limit
113
118
119
+
114
120
def extract_search_results (payload : Dict ) -> Tuple [Iterable , int ]:
115
121
"""
116
122
Extract issues based on search query.
117
123
"""
118
124
# Get the edges connecting to all the repositories.
119
- base_data : List = (
120
- payload ["data" ].get ("search" ).get ("edges" )
121
- )
125
+ base_data : List = payload ["data" ].get ("search" ).get ("edges" )
122
126
123
127
# Extract rate limit value.
124
128
rate_limit : int = payload ["data" ].get ("rateLimit" ).get ("remaining" )
@@ -132,7 +136,10 @@ def extract_search_results(payload: Dict) -> Tuple[Iterable, int]:
132
136
133
137
return list (pipeline ), rate_limit
134
138
135
- def identify_mode (name : str , repo : str , user : bool , hacktoberfest : bool ) -> Tuple [str , Dict , str ]:
139
+
140
+ def identify_mode (
141
+ name : str , repo : str , user : bool , hacktoberfest : bool
142
+ ) -> Tuple [str , Dict , str ]:
136
143
"""
137
144
Identify the mode based on arguments passed.
138
145
@@ -164,13 +171,16 @@ def identify_mode(name: str, repo: str, user: bool, hacktoberfest: bool) -> Tupl
164
171
165
172
if hacktoberfest and not repo :
166
173
query = search_query
167
- variables ["queryString" ] = ' topic:hacktoberfest '
174
+ variables ["queryString" ] = " topic:hacktoberfest "
168
175
if name :
169
- variables ["queryString" ]+= f' user:{ name } '
170
- mode = "search"
176
+ variables ["queryString" ] += f" user:{ name } "
177
+ mode = "search"
171
178
172
179
if repo and hacktoberfest :
173
- console .print ("Error: --hacktoberfest or --hf cannot be used with --repo flag" , style = "bold red" )
180
+ console .print (
181
+ "Error: --hacktoberfest or --hf cannot be used with --repo flag:x:" ,
182
+ style = "bold red" ,
183
+ )
174
184
sys .exit ()
175
185
176
186
return query , variables , mode
0 commit comments