From d347c2ca2acb1a324a1ecac6239e3c3a856f87c9 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 1 Apr 2022 17:03:36 -0400 Subject: [PATCH] [skip ci] Remove unnecessary annotations, run linter (#11299) --- .../eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt | 3 +-- .../tachiyomi/multisrc/guya/GuyaGenerator.kt | 6 ++++-- .../tachiyomi/multisrc/hentaihand/HentaiHand.kt | 11 ++++------- .../tachiyomi/multisrc/monochrome/MonochromeCMS.kt | 2 -- .../tachiyomi/extension/all/comickfun/ComickFun.kt | 14 -------------- .../all/comickfun/ComickFunSerialization.kt | 8 -------- .../extension/all/leagueoflegends/LOLFactory.kt | 2 -- .../extension/all/leagueoflegends/LOLUniverse.kt | 2 -- .../extension/all/simplyhentai/SimplyHentai.kt | 2 -- .../all/simplyhentai/SimplyHentaiFactory.kt | 2 -- src/all/thelibraryofohara/build.gradle | 1 - .../tachiyomi/extension/en/pururin/Pururin.kt | 2 -- .../extension/en/zinchanmanga/ZinChanManga.kt | 2 -- src/es/leermangasxyz/build.gradle | 1 - 14 files changed, 9 insertions(+), 49 deletions(-) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt index 7516af428..b7077a955 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/genkan/Genkan.kt @@ -102,11 +102,10 @@ open class Genkan( description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume") thumbnail_url = styleToUrl(document.select("div.media a").first()) genre = listOfNotNull( - document.selectFirst(countryOfOriginSelector)?.let { countryOfOriginToSeriesType(it.text())} + document.selectFirst(countryOfOriginSelector)?.let { countryOfOriginToSeriesType(it.text()) } ).joinToString() } - override fun chapterListSelector() = "div.col-lg-9 div.flex" override fun chapterFromElement(element: Element): SChapter { diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/GuyaGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/GuyaGenerator.kt index 0a0c5aeaf..ba5951809 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/GuyaGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/guya/GuyaGenerator.kt @@ -16,8 +16,10 @@ class GuyaGenerator : ThemeSourceGenerator { SingleLang("Guya", "https://guya.moe", "en", overrideVersionCode = 18), SingleLang("Danke fürs Lesen", "https://danke.moe", "en", className = "DankeFursLesen"), SingleLang("Hachirumi", "https://hachirumi.com", "en", isNsfw = true), - MultiLang("Magical Translators", "https://mahoushoujobu.com", listOf("en", "es", "pl"), - overrideVersionCode = 1), + MultiLang( + "Magical Translators", "https://mahoushoujobu.com", listOf("en", "es", "pl"), + overrideVersionCode = 1 + ), ) companion object { @JvmStatic diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt index 5eb538f99..8420e62d3 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/hentaihand/HentaiHand.kt @@ -21,7 +21,6 @@ import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.int import kotlinx.serialization.json.jsonArray -import kotlinx.serialization.json.jsonNull import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.put @@ -84,7 +83,7 @@ abstract class HentaiHand( .addQueryParameter("sort", "popularity") .addQueryParameter("order", "desc") .addQueryParameter("duration", "all") - hhLangId.forEachIndexed() {index, it -> + hhLangId.forEachIndexed() { index, it -> url.addQueryParameter("languages[${-index - 1}]", it.toString()) } // if (altLangId != null) url.addQueryParameter("languages", altLangId.toString()) @@ -101,7 +100,7 @@ abstract class HentaiHand( .addQueryParameter("sort", "uploaded_at") .addQueryParameter("order", "desc") .addQueryParameter("duration", "all") - hhLangId.forEachIndexed() {index, it -> + hhLangId.forEachIndexed() { index, it -> url.addQueryParameter("languages[${-index - 1}]", it.toString()) } return GET(url.toString()) @@ -132,7 +131,7 @@ abstract class HentaiHand( .addQueryParameter("page", page.toString()) .addQueryParameter("q", query) - hhLangId.forEachIndexed() {index, it -> + hhLangId.forEachIndexed() { index, it -> url.addQueryParameter("languages[${-index - 1}]", it.toString()) } @@ -150,7 +149,7 @@ abstract class HentaiHand( is LookupFilter -> { filter.state.split(",").map { it.trim() }.filter { it.isNotBlank() }.map { lookupFilterId(it, filter.uri) ?: throw Exception("No ${filter.singularName} \"$it\" was found") - }.forEachIndexed() {index, it -> + }.forEachIndexed() { index, it -> if (!(filter.uri == "languages" && hhLangId.contains(it))) url.addQueryParameter(filter.uri + "[$index]", it.toString()) } @@ -192,8 +191,6 @@ abstract class HentaiHand( else -> SManga.COMPLETED } - - description = listOf( Pair("Alternative Title", obj["alternative_title"]!!.jsonPrimitive.content), Pair("Groups", jsonArrayToString("groups", obj)), diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/monochrome/MonochromeCMS.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/monochrome/MonochromeCMS.kt index 443e40dac..8f0c4f7e5 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/monochrome/MonochromeCMS.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/monochrome/MonochromeCMS.kt @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import okhttp3.Headers @@ -16,7 +15,6 @@ import okhttp3.Response import rx.Observable import uy.kohesive.injekt.injectLazy -@ExperimentalSerializationApi open class MonochromeCMS( override val name: String, override val baseUrl: String, diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt index b0d2dc336..3f6aabe60 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFun.kt @@ -10,7 +10,6 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json @@ -27,7 +26,6 @@ import okhttp3.Response import rx.Observable import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get -import java.lang.UnsupportedOperationException const val SEARCH_PAGE_LIMIT = 100 @@ -37,7 +35,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S private val apiBase = "https://api.comick.fun" override val supportsLatest = true - @ExperimentalSerializationApi private val json: Json by lazy { Json(from = Injekt.get()) { serializersModule = SerializersModule { @@ -47,7 +44,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } } - @ExperimentalSerializationApi private val mangaIdCache = SMangaDeserializer.mangaIdCache final override fun headersBuilder() = Headers.Builder().apply { @@ -90,7 +86,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S /** Utils **/ /** Returns an observable which emits a single value -> the manga's id **/ - @ExperimentalSerializationApi private fun chapterId(manga: SManga): Observable { val mangaSlug = slug(manga) return mangaIdCache[mangaSlug]?.let { Observable.just(it) } @@ -105,13 +100,11 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S /** Popular Manga **/ - @ExperimentalSerializationApi override fun fetchPopularManga(page: Int) = fetchSearchManga(page, "", FilterList(emptyList())) override fun popularMangaRequest(page: Int) = throw UnsupportedOperationException("Not used") override fun popularMangaParse(response: Response) = throw UnsupportedOperationException("Not used") /** Latest Manga **/ - @ExperimentalSerializationApi override fun latestUpdatesParse(response: Response): MangasPage { val noResults = MangasPage(emptyList(), false) if (response.code == 204) @@ -129,7 +122,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S return GET("$url", headers) } - @ExperimentalSerializationApi override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable { if (!query.startsWith(SLUG_SEARCH_PREFIX)) return super.fetchSearchManga(page, query, filters) @@ -157,7 +149,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S return GET("$url", headers) } - @ExperimentalSerializationApi override fun searchMangaParse(response: Response) = json.decodeFromString>(response.body!!.string()) .let { MangasPage(it, it.size == SEARCH_PAGE_LIMIT) } @@ -168,7 +159,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } // Shenanigans to allow "open in webview" to show a webpage instead of JSON - @ExperimentalSerializationApi override fun fetchMangaDetails(manga: SManga): Observable { return client.newCall(apiMangaDetailsRequest(manga)) .asObservableSuccess() @@ -177,7 +167,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } } - @ExperimentalSerializationApi override fun mangaDetailsParse(response: Response) = json.decodeFromString( deserializer = jsonFlatten(objKey = "comic", "id", "title", "desc", "status", "country", "slug"), response.body!!.string() @@ -188,7 +177,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S private fun chapterListRequest(page: Int, mangaId: Int) = GET("$apiBase/comic/$mangaId/chapter?page=$page&limit=$SEARCH_PAGE_LIMIT", headers) - @ExperimentalSerializationApi override fun fetchChapterList(manga: SManga): Observable> { return if (manga.status != SManga.LICENSED) { chapterId(manga).concatMap { id -> @@ -213,7 +201,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S } } - @ExperimentalSerializationApi override fun chapterListParse(response: Response) = json.decodeFromString( deserializer = deepSelectDeserializer>("chapters"), response.body!!.string() @@ -223,7 +210,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S override fun pageListRequest(chapter: SChapter) = GET("$apiBase/chapter/${hid(chapter)}", headers, CacheControl.FORCE_NETWORK) - @ExperimentalSerializationApi override fun pageListParse(response: Response) = json.decodeFromString( deserializer = deepSelectDeserializer>("chapter", "images", tDeserializer = ListSerializer(deepSelectDeserializer("url"))), diff --git a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunSerialization.kt b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunSerialization.kt index 8d35393ab..55a983b9d 100644 --- a/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunSerialization.kt +++ b/src/all/comickfun/src/eu/kanade/tachiyomi/extension/all/comickfun/ComickFunSerialization.kt @@ -4,7 +4,6 @@ import android.os.Build import android.text.Html import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.descriptors.SerialDescriptor @@ -20,7 +19,6 @@ import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonTransformingSerializer import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.serializer -import java.lang.Exception import java.text.SimpleDateFormat import kotlin.math.pow import kotlin.math.truncate @@ -40,7 +38,6 @@ import kotlin.math.truncate * * deepSelectDeserializer<String>("user", "name", "first") deserializes the above into "John" */ -@ExperimentalSerializationApi inline fun deepSelectDeserializer(vararg keys: String, tDeserializer: KSerializer = serializer()): KSerializer { val descriptors = keys.foldRight(listOf(tDeserializer.descriptor)) { x, acc -> acc + acc.last().let { @@ -89,7 +86,6 @@ inline fun jsonFlatten( } } -@ExperimentalSerializationApi inline fun Decoder.decodeStructureByKnownName(descriptor: SerialDescriptor, decodeFn: CompositeDecoder.(Sequence>) -> T): T { return decodeStructure(descriptor) { decodeFn( @@ -101,7 +97,6 @@ inline fun Decoder.decodeStructureByKnownName(descriptor: SerialDescriptor, } } -@ExperimentalSerializationApi class SChapterDeserializer : KSerializer { override val descriptor = buildClassSerialDescriptor(SChapter::class.qualifiedName!!) { element("chap") @@ -144,7 +139,6 @@ class SChapterDeserializer : KSerializer { return formattedTitle.toString() } - @ExperimentalSerializationApi override fun deserialize(decoder: Decoder): SChapter { return SChapter.create().apply { var chap: String? = null @@ -177,7 +171,6 @@ class SChapterDeserializer : KSerializer { override fun serialize(encoder: Encoder, value: SChapter) = throw UnsupportedOperationException("Unsupported") } -@ExperimentalSerializationApi class SMangaDeserializer : KSerializer { private fun cleanDesc(s: String) = ( if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) @@ -204,7 +197,6 @@ class SMangaDeserializer : KSerializer { element("country", isOptional = true) } - @ExperimentalSerializationApi override fun deserialize(decoder: Decoder): SManga { return SManga.create().apply { var id: Int? = null diff --git a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLFactory.kt b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLFactory.kt index f8be41f94..2548fc67c 100644 --- a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLFactory.kt +++ b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLFactory.kt @@ -1,9 +1,7 @@ package eu.kanade.tachiyomi.extension.all.leagueoflegends import eu.kanade.tachiyomi.source.SourceFactory -import kotlinx.serialization.ExperimentalSerializationApi -@ExperimentalSerializationApi class LOLFactory : SourceFactory { override fun createSources() = listOf( LOLUniverse("en_us"), diff --git a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt index c7470429b..171c88d32 100644 --- a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt +++ b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import okhttp3.Response @@ -17,7 +16,6 @@ import uy.kohesive.injekt.injectLazy import java.text.SimpleDateFormat import java.util.Locale -@ExperimentalSerializationApi class LOLUniverse( private val siteLang: String, override val lang: String = siteLang.substring(0, 2) diff --git a/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt b/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt index 5ce3110ff..a273c089b 100644 --- a/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt +++ b/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentai.kt @@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import okhttp3.Response @@ -22,7 +21,6 @@ import uy.kohesive.injekt.api.get import java.text.SimpleDateFormat import java.util.Locale -@ExperimentalSerializationApi open class SimplyHentai(override val lang: String) : ConfigurableSource, HttpSource() { override val name = "Simply Hentai" diff --git a/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentaiFactory.kt b/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentaiFactory.kt index 376107bc9..71a1e6916 100644 --- a/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentaiFactory.kt +++ b/src/all/simplyhentai/src/eu/kanade/tachiyomi/extension/all/simplyhentai/SimplyHentaiFactory.kt @@ -1,9 +1,7 @@ package eu.kanade.tachiyomi.extension.all.simplyhentai import eu.kanade.tachiyomi.source.SourceFactory -import kotlinx.serialization.ExperimentalSerializationApi -@ExperimentalSerializationApi class SimplyHentaiFactory : SourceFactory { override fun createSources() = listOf( SimplyHentai("en"), diff --git a/src/all/thelibraryofohara/build.gradle b/src/all/thelibraryofohara/build.gradle index 7a68b4416..80896c757 100644 --- a/src/all/thelibraryofohara/build.gradle +++ b/src/all/thelibraryofohara/build.gradle @@ -6,7 +6,6 @@ ext { pkgNameSuffix = 'all.thelibraryofohara' extClass = '.TheLibraryOfOharaFactory' extVersionCode = 1 - libVersion = '1.2' } apply from: "$rootDir/common.gradle" diff --git a/src/en/pururin/src/eu/kanade/tachiyomi/extension/en/pururin/Pururin.kt b/src/en/pururin/src/eu/kanade/tachiyomi/extension/en/pururin/Pururin.kt index 1710ea99a..66f494449 100644 --- a/src/en/pururin/src/eu/kanade/tachiyomi/extension/en/pururin/Pururin.kt +++ b/src/en/pururin/src/eu/kanade/tachiyomi/extension/en/pururin/Pururin.kt @@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import kotlinx.serialization.json.decodeFromJsonElement @@ -19,7 +18,6 @@ import okhttp3.Request import okhttp3.Response import uy.kohesive.injekt.injectLazy -@ExperimentalSerializationApi class Pururin : HttpSource() { override val name = "Pururin" diff --git a/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt b/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt index 7479270a5..92e831eef 100644 --- a/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt +++ b/src/en/zinchanmanga/src/eu/kanade/tachiyomi/extension/en/zinchanmanga/ZinChanManga.kt @@ -9,13 +9,11 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.online.HttpSource -import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.json.Json import okhttp3.Response import uy.kohesive.injekt.injectLazy -@ExperimentalSerializationApi class ZinChanManga : HttpSource() { override val lang = "en" diff --git a/src/es/leermangasxyz/build.gradle b/src/es/leermangasxyz/build.gradle index 783ac23a7..260e698ea 100644 --- a/src/es/leermangasxyz/build.gradle +++ b/src/es/leermangasxyz/build.gradle @@ -6,7 +6,6 @@ ext { pkgNameSuffix = 'es.leermangasxyz' extClass = '.LeerMangasXYZ' extVersionCode = 1 - libVersion = '1.2' } apply from: "$rootDir/common.gradle" \ No newline at end of file