1515# You should have received a copy of the GNU Lesser General Public License
1616# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
18+ from typing import Any , Callable , Dict , Optional
1819from urllib .parse import urlparse
1920
21+ import requests
22+
2023
2124class _StdoutStream (object ):
22- def __call__ (self , chunk ):
25+ def __call__ (self , chunk ) -> None :
2326 print (chunk )
2427
2528
26- def response_content (response , streamed , action , chunk_size ):
29+ def response_content (
30+ response : requests .Response ,
31+ streamed : bool ,
32+ action : Optional [Callable ],
33+ chunk_size : int ,
34+ ):
2735 if streamed is False :
2836 return response .content
2937
@@ -35,7 +43,7 @@ def response_content(response, streamed, action, chunk_size):
3543 action (chunk )
3644
3745
38- def copy_dict (dest , src ) :
46+ def copy_dict (dest : Dict [ str , Any ], src : Dict [ str , Any ]) -> None :
3947 for k , v in src .items ():
4048 if isinstance (v , dict ):
4149 # Transform dict values to new attributes. For example:
@@ -47,7 +55,7 @@ def copy_dict(dest, src):
4755 dest [k ] = v
4856
4957
50- def clean_str_id (id ) :
58+ def clean_str_id (id : str ) -> str :
5159 return id .replace ("/" , "%2F" ).replace ("#" , "%23" )
5260
5361
@@ -59,11 +67,11 @@ def sanitize_parameters(value):
5967 return value
6068
6169
62- def sanitized_url (url ) :
70+ def sanitized_url (url : str ) -> str :
6371 parsed = urlparse (url )
6472 new_path = parsed .path .replace ("." , "%2E" )
6573 return parsed ._replace (path = new_path ).geturl ()
6674
6775
68- def remove_none_from_dict (data ) :
76+ def remove_none_from_dict (data : Dict [ str , Any ]) -> Dict [ str , Any ] :
6977 return {k : v for k , v in data .items () if v is not None }
0 commit comments