package fr.free.nrw.commons.contributions;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Locale;

import fr.free.nrw.commons.PageTitle;
import io.reactivex.Single;

class RxJava2Tasks {

    private static final String UPLOAD_COUNT_URL_TEMPLATE =
            "https://tools.wmflabs.org/urbanecmbot/uploadsbyuser/uploadsbyuser.py?user=%s";

    static Single<Integer> getUploadCount(String userName) {
        return Single.fromCallable(() -> {
                    URL url = new URL(String.format(Locale.ENGLISH, UPLOAD_COUNT_URL_TEMPLATE,
                                new PageTitle(userName).getText()));
                    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                    BufferedReader bufferedReader = new BufferedReader(new
                            InputStreamReader(urlConnection.getInputStream()));
                    String uploadCount = bufferedReader.readLine();
                    bufferedReader.close();
                    urlConnection.disconnect();
                    return Integer.parseInt(uploadCount);
        });
    }
}

@@ -542,24 +542,16 @@
         
-        
 URL url 
@@ -637,28 +637,16 @@
         
-           
- 
 new Page
@@ -670,32 +670,24 @@
 etText()));%0A
-        
             
@@ -774,24 +774,16 @@
         
- 
-       
 Buffered
@@ -849,24 +849,16 @@
         
-  
-      
 InputStr
@@ -913,24 +913,16 @@
         
-    
-    
 String u
@@ -973,24 +973,16 @@
         
-     
-   
 buffered
@@ -1009,24 +1009,16 @@
         
-       
- 
 urlConne
@@ -1033,32 +1033,24 @@
 sconnect();%0A
-        
             

Fix indentation