From f702e8b32a8861bd9c521a6d6c7830760994e3dc Mon Sep 17 00:00:00 2001 From: ilya Date: Fri, 22 Sep 2023 16:09:44 +0300 Subject: [PATCH] formatting --- .../org/scalawiki/query/SinglePageQuery.scala | 39 +++++++---- .../org/scalawiki/wlx/stat/StatParams.scala | 70 +++++++++++++------ .../wlx/stat/reports/MonumentDbStat.scala | 17 +++-- 3 files changed, 85 insertions(+), 41 deletions(-) diff --git a/scalawiki-core/src/main/scala/org/scalawiki/query/SinglePageQuery.scala b/scalawiki-core/src/main/scala/org/scalawiki/query/SinglePageQuery.scala index a09462a8..201f3c0e 100644 --- a/scalawiki-core/src/main/scala/org/scalawiki/query/SinglePageQuery.scala +++ b/scalawiki-core/src/main/scala/org/scalawiki/query/SinglePageQuery.scala @@ -6,26 +6,37 @@ import scala.concurrent.Future trait SinglePageQuery { - def whatTranscludesHere(namespaces: Set[Int] = Set.empty, continueParam: Option[(String, String)] = None): Future[Iterable[Page]] + def whatTranscludesHere( + namespaces: Set[Int] = Set.empty, + continueParam: Option[(String, String)] = None): Future[Iterable[Page]] - def categoryMembers(namespaces: Set[Int] = Set.empty, continueParam: Option[(String, String)] = None): Future[Iterable[Page]] + def categoryMembers( + namespaces: Set[Int] = Set.empty, + continueParam: Option[(String, String)] = None): Future[Iterable[Page]] - def revisions(namespaces: Set[Int] = Set.empty, props: Set[String] = Set.empty, continueParam: Option[(String, String)] = None): Future[Iterable[Page]] + def revisions( + namespaces: Set[Int] = Set.empty, + props: Set[String] = Set.empty, + continueParam: Option[(String, String)] = None): Future[Iterable[Page]] def revisionsByGenerator( - generator: String, generatorPrefix: String, - namespaces: Set[Int] = Set.empty, props: Set[String] = Set.empty, - continueParam: Option[(String, String)] = None, - limit: String = "max", - titlePrefix: Option[String] = None): Future[Iterable[Page]] + generator: String, + generatorPrefix: String, + namespaces: Set[Int] = Set.empty, + props: Set[String] = Set.empty, + continueParam: Option[(String, String)] = None, + limit: String = "max", + titlePrefix: Option[String] = None): Future[Iterable[Page]] def imageInfoByGenerator( - generator: String, generatorPrefix: String, - namespaces: Set[Int] = Set(), - props: Set[String] = Set("timestamp", "user", "size", "url" /*, "extmetadata"*/), - continueParam: Option[(String, String)] = None, - limit: String = "max", - titlePrefix: Option[String] = None): Future[Iterable[Page]] + generator: String, + generatorPrefix: String, + namespaces: Set[Int] = Set(), + props: Set[String] = + Set("timestamp", "user", "size", "url" /*, "extmetadata"*/ ), + continueParam: Option[(String, String)] = None, + limit: String = "max", + titlePrefix: Option[String] = None): Future[Iterable[Page]] def edit(text: String, summary: Option[String] = None, diff --git a/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/StatParams.scala b/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/StatParams.scala index 0c849f73..fd171c8b 100644 --- a/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/StatParams.scala +++ b/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/StatParams.scala @@ -33,35 +33,59 @@ import org.rogach.scallop._ class StatParams(arguments: Seq[String]) extends ScallopConf(arguments) { val years = opt[List[Int]]("year", 'y', "contest year.") - val startYear = opt[Int]("startyear", 's', "contest year.") - val campaign = opt[String]("campaign", 'c', "upload campaign, like wlm-ua.", required = true) + val startYear = opt[Int]("start-year", 's', "contest year.") + val campaign = opt[String]("campaign", + 'c', + "upload campaign, like wlm-ua.", + required = true) val regions = opt[List[String]]("region", 'r', "region code") - val exceptRegions = opt[List[String]](name = "exceptregions", descr = "except region codes") + val exceptRegions = + opt[List[String]](name = "except-regions", descr = "except region codes") val cities = opt[List[String]](name = "cities", descr = "cities") - val exceptCities = opt[List[String]](name = "exceptcities", descr = "except cities") - val newObjectRating = opt[Double](name = "new-object-rating", descr = "new object rating") - val newAuthorObjectRating = opt[Double](name = "new-author-object-rating", descr = "new author object rating") - val numberOfAuthorsBonus = opt[Boolean](name = "number-of-authors-bonus", descr = "number of authors bonus") - val numberOfImagesBonus = opt[Boolean](name = "number-of-images-bonus", descr = "number of images bonus") + val exceptCities = + opt[List[String]](name = "except-cities", descr = "except cities") + val newObjectRating = + opt[Double](name = "new-object-rating", descr = "new object rating") + val newAuthorObjectRating = opt[Double](name = "new-author-object-rating", + descr = "new author object rating") + val numberOfAuthorsBonus = opt[Boolean](name = "number-of-authors-bonus", + descr = "number of authors bonus") + val numberOfImagesBonus = opt[Boolean](name = "number-of-images-bonus", + descr = "number of images bonus") val baseRate = opt[Double](name = "base-rate", descr = "base rate") val gallery = opt[Boolean](name = "gallery", descr = "gallery") val fillLists = opt[Boolean](name = "fill-lists", descr = "fill lists") val wrongIds = opt[Boolean](name = "wrong-ids", descr = "report wrong ids") - val missingIds = opt[Boolean](name = "missing-ids", descr = "report missing ids") - val multipleIds = opt[Boolean](name = "multiple-ids", descr = "report multiple ids") - val lowRes = opt[Boolean](name = "low-res", descr = "report low resolution photos") - val specialNominations = opt[Boolean](name = "special-nominations", descr = "report special nominations") - val regionalStat = opt[Boolean](name = "regional-stat", descr = "report regional statistics") - val regionalDetails = opt[Boolean](name = "regional-details", descr = "report regional detailed statistics") - val authorsStat = opt[Boolean](name = "authors-stat", descr = "report authors statistics") - val regionalGallery = opt[Boolean](name = "regional-gallery", descr = "report regional gallery") - val missingGallery = opt[Boolean](name = "missing-gallery", descr = "report missing galleries") - val placeDetection = opt[Boolean](name = "place-detection", descr = "report place detection") - val newMonuments = opt[Boolean](name = "new-monuments", descr = "new monuments") - val rateInputDistribution = opt[Boolean](name = "rate-input-distribution", descr = "rate input distribution") - val mostPopularMonuments = opt[Boolean](name = "most-popular-monuments", descr = "most popular monuments") + val missingIds = + opt[Boolean](name = "missing-ids", descr = "report missing ids") + val multipleIds = + opt[Boolean](name = "multiple-ids", descr = "report multiple ids") + val lowRes = + opt[Boolean](name = "low-res", descr = "report low resolution photos") + val specialNominations = opt[Boolean](name = "special-nominations", + descr = "report special nominations") + val regionalStat = + opt[Boolean](name = "regional-stat", descr = "report regional statistics") + val regionalDetails = opt[Boolean](name = "regional-details", + descr = + "report regional detailed statistics") + val authorsStat = + opt[Boolean](name = "authors-stat", descr = "report authors statistics") + val regionalGallery = + opt[Boolean](name = "regional-gallery", descr = "report regional gallery") + val missingGallery = + opt[Boolean](name = "missing-gallery", descr = "report missing galleries") + val placeDetection = + opt[Boolean](name = "place-detection", descr = "report place detection") + val newMonuments = + opt[Boolean](name = "new-monuments", descr = "new monuments") + val rateInputDistribution = opt[Boolean](name = "rate-input-distribution", + descr = "rate input distribution") + val mostPopularMonuments = opt[Boolean](name = "most-popular-monuments", + descr = "most popular monuments") val minMpx = opt[Float](name = "min-mpx", descr = "minimum megapixels") - val previousYearsGallery = opt[Boolean](name = "prev-years-gallery", descr = "previous years gallery") + val previousYearsGallery = + opt[Boolean](name = "prev-years-gallery", descr = "previous years gallery") verify() } @@ -104,4 +128,4 @@ object StatParams { previousYearsGallery = conf.previousYearsGallery.getOrElse(false) ) } -} \ No newline at end of file +} diff --git a/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/reports/MonumentDbStat.scala b/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/reports/MonumentDbStat.scala index 7c639dcf..c2f6a464 100644 --- a/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/reports/MonumentDbStat.scala +++ b/scalawiki-wlx/src/main/scala/org/scalawiki/wlx/stat/reports/MonumentDbStat.scala @@ -10,7 +10,15 @@ class MonumentDbStat { val format = NumberFormat.getPercentInstance val columns = Seq( - "country", "lang", "total", "name", "address", "coordinates", "image", "commonscat", "article" + "country", + "lang", + "total", + "name", + "address", + "coordinates", + "image", + "commonscat", + "article" ) def getStat(monumentDbs: Seq[MonumentDB]) = { @@ -32,7 +40,10 @@ class MonumentDbStat { def withPercentage(value: Int) = s"$value (${format.format(value.toDouble / total.toDouble)})" - Seq(country, lang, total.toString, + Seq( + country, + lang, + total.toString, withPercentage(name), withPercentage(address), withPercentage(coordinates), @@ -48,5 +59,3 @@ class MonumentDbStat { } } - -