From a9701ce0153e1c648d1c01787068d9b237d8956a Mon Sep 17 00:00:00 2001 From: colons Date: Tue, 7 Nov 2023 19:02:53 +0000 Subject: [PATCH] Break long domains up to placate flake8. This is silly. I should just be writing these to a file. --- .../commands/update_mastodon_instances.py | 23 +++++++- nkdsu/apps/vote/mastodon_instances.py | 58 +++++++++++++++++-- 2 files changed, 74 insertions(+), 7 deletions(-) diff --git a/nkdsu/apps/vote/management/commands/update_mastodon_instances.py b/nkdsu/apps/vote/management/commands/update_mastodon_instances.py index ed29ea90..26ee12d3 100644 --- a/nkdsu/apps/vote/management/commands/update_mastodon_instances.py +++ b/nkdsu/apps/vote/management/commands/update_mastodon_instances.py @@ -13,6 +13,23 @@ } +def fmt(domain: str) -> str: + """ + Break a domain into chunks, so that black is able to combine or rejoin it + as necessary, but only if it's particularly long. + """ + + if len(domain) > 100: + return '(\n {}\n )'.format( + '\n '.join( + repr(('' if i == 0 else '.') + chunk) + for i, chunk in enumerate(domain.split('.')) + ) + ) + else: + return repr(domain) + + class Command(BaseCommand): def write_instances(self, instances: list[str]) -> None: module_path = os.path.join( @@ -24,9 +41,11 @@ def write_instances(self, instances: list[str]) -> None: "# this file is populated by running `python manage.py" " update_mastodon_instances`\n# do not edit it by hand\n\n" ) + splitter = ',\n ' f.write( - "MASTODON_INSTANCES: set[str] = {" - f" {', '.join((repr(i) for i in instances))} }}" + "MASTODON_INSTANCES: set[str] = {\n" + f" {splitter.join((fmt(i) for i in instances))},\n" + "}" ) subprocess.check_call(['black', module_path]) diff --git a/nkdsu/apps/vote/mastodon_instances.py b/nkdsu/apps/vote/mastodon_instances.py index 94a1dcc7..d4efe7b6 100644 --- a/nkdsu/apps/vote/mastodon_instances.py +++ b/nkdsu/apps/vote/mastodon_instances.py @@ -6748,7 +6748,13 @@ 'aa44e169.ngrok.io', 'aa63-82-65-180-17.eu.ngrok.io', 'aaa.awoo.fun', - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.lubar.me', + ( + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + '.lubar' + '.me' + ), 'aabb-2405-201-e026-50c6-9848-b744-c453-6423.ngrok.io', 'aachen.social', 'aad7c79d.ngrok.io', @@ -8071,6 +8077,7 @@ 'ap.fourth-brigade.jp', 'ap.galaxians.org', 'ap.gjcloak.top', + 'ap.hacktk.net', 'ap.iamawesome.ru', 'ap.input.sh', 'ap.jackmeyers.co', @@ -8490,6 +8497,7 @@ 'asse.world', 'assemblag.es', 'assemblylabx.com', + 'assetsfolder.nohost.me', 'assilvestrar.club', 'asso.lgbt', 'associated.social', @@ -10640,6 +10648,7 @@ 'blogsquad.social', 'blogue.narf.ca', 'blogueur-de-france.fr', + 'blogz.zaclys.com', 'blombus.com', 'bloodandthunderleviathan.herokuapp.com', 'bloodmountain.herokuapp.com', @@ -11617,6 +11626,7 @@ 'cafe.chillout.chat', 'cafe.datamol.org', 'cafe.diagonalley.club', + 'cafe.heslach.international', 'cafe.konstantintutsch.com', 'cafe.mantyke.icu', 'cafe.moien.net', @@ -13599,6 +13609,7 @@ 'cote.io', 'cotellese.net', 'cotix.gg', + 'cottoncandy.cafe', 'couch.beerriot.com', 'cough.reitrace.ga', 'couldbe.art', @@ -15256,6 +15267,7 @@ 'dispatches.fm', 'disperfected.com', 'displaced.social', + 'display.whenpeople.live', 'displayeurope.social', 'displeu.dev.osalliance.com', 'disputemag.com', @@ -16362,6 +16374,7 @@ 'ejls.fr', 'ek62e7g0.activitypub-troll.cf', 'eka.rodeo', + 'ekdnam-shuttlecraft.glitch.me', 'ekho.nullzone.fr', 'ekimemo.info', 'ekklisia.kleio.dev', @@ -16401,6 +16414,7 @@ 'electricglen.com', 'electricjidam.zyr8wwlkbp8mi196.myfritz.net', 'electrickite.org', + 'electricmonk.de', 'electricmonk.social', 'electricpaper.love', 'electricpea.ch', @@ -18062,6 +18076,7 @@ 'fedi.skladka.net', 'fedi.skyizwhite.dev', 'fedi.skyrina.dev', + 'fedi.slatecave.net', 'fedi.slipfox.xyz', 'fedi.snepi.space', 'fedi.sobe.world', @@ -18248,6 +18263,7 @@ 'fedilemmy.net', 'fedilists.com', 'fedilove.cyou', + 'fedimagazine.tokyo', 'fedimaker.space', 'fedimarks.glitch.me', 'fedimas.com', @@ -18404,6 +18420,7 @@ 'fediverser.communick.dev', 'fediversereport.com', 'fediversity.site', + 'fediverso.bakunin.nohost.me', 'fediverso.club', 'fediverso.manualdousuario.net', 'fediverso.net', @@ -18560,6 +18577,7 @@ 'ff.jennifilm.nz', 'ff.kurotanesou.online', 'ff.lapy.link', + 'ff.menac.at', 'ff.metalslime.ink', 'ff.mizunashi.work', 'ff.mycrowd.ca', @@ -21365,6 +21383,7 @@ 'gruezi.net', 'gruifor.eu', 'grumble.social', + 'grumbleflap.shannonmcmaster.com', 'grumpy-snake-45.loca.lt', 'grumpyoldme.de', 'grumpys.online', @@ -22095,6 +22114,7 @@ 'headpats.cafe', 'headphone.actor', 'heads.social', + 'healingwithyessie.com', 'healthcode.cloud', 'heapoverflow.ml', 'hear-me.social', @@ -22181,7 +22201,14 @@ 'hello.mailpile.is', 'hello.mashiro.top', 'hello.onlyroleplayth.com', - 'helloeverybodymynameismarkiplierandwelcometofivenightsatfreddys.anindiehorrorgamethatyouguyssuggestedenmasseandisawthatyamimash.playeditandhesaidthatitwasreallyreallygoodsoimveryeagertoseewha.tisupandthatisaterrifyinganimatronicbear.fnaf.stream', + ( + 'helloeverybodymynameismarkiplierandwelcometofivenightsatfreddys' + '.anindiehorrorgamethatyouguyssuggestedenmasseandisawthatyamimash' + '.playeditandhesaidthatitwasreallyreallygoodsoimveryeagertoseewha' + '.tisupandthatisaterrifyinganimatronicbear' + '.fnaf' + '.stream' + ), 'hellomasto.com', 'hellomasto.pl', 'hellosoft.org', @@ -22800,7 +22827,12 @@ 'horse.im', 'horsecr.app', 'horsegoddess.masto.host', - 'horsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorse.horsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorse.lubar.me', + ( + 'horsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorse' + '.horsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorsehorse' + '.lubar' + '.me' + ), 'horsemans.online', 'horseracing.social', 'horserock.xyz', @@ -23031,6 +23063,7 @@ 'hub.rice.id.au', 'hub.rick.gr', 'hub.rootfs.eu', + 'hub.rpi-virtuell.de', 'hub.rsplwe.com', 'hub.sakuragawa.moe', 'hub.sattvalife.ru', @@ -30585,6 +30618,7 @@ 'mastodon.brnrs.pl', 'mastodon.brodi.space', 'mastodon.browarski.de', + 'mastodon.brunovianna.net', 'mastodon.brussels', 'mastodon.bryce.co', 'mastodon.bstly.de', @@ -31749,6 +31783,7 @@ 'mastodon.inubo.ch', 'mastodon.invoke.coffee', 'mastodon.inzeiten.de', + 'mastodon.io.seg.br', 'mastodon.iokibe.net', 'mastodon.iosdevhappyhour.com', 'mastodon.iot.tokyo', @@ -34708,6 +34743,7 @@ 'meetbeauties.social', 'meetiko.org', 'meetplay.net', + 'meetups.infosec.exchange', 'meetwoof.com', 'meety.me', 'mefi.social', @@ -34970,7 +35006,6 @@ 'mexico-pensante.blog', 'mexico.spacepatrol.org', 'mexicosocial.mx', - 'mf1.social', 'mfc19.wordpress.com', 'mfg.fyi', 'mfjt-gotosocial.fly.dev', @@ -36134,6 +36169,7 @@ 'misskey.tsukiyo.dev', 'misskey.tsuyabashi.dev', 'misskey.tsuyure.net', + 'misskey.tunamaguro.dev', 'misskey.tunetalk.jp', 'misskey.turretlabs.io', 'misskey.twink.ink', @@ -37387,6 +37423,7 @@ 'mstdn.cnova.de', 'mstdn.co.uk', 'mstdn.co33k.org', + 'mstdn.coasa.me', 'mstdn.coffee-break.cc', 'mstdn.com.au', 'mstdn.cool', @@ -38259,6 +38296,7 @@ 'murder.town', 'murf.org', 'murffys-place.club', + 'muri.muri.zip', 'muri.network', 'murmf.art', 'murmur.masto.host', @@ -39222,6 +39260,7 @@ 'nextcloud.cis-reunion.fr', 'nextcloud.constellation-mu.se', 'nextcloud.cosmic-engineer.com', + 'nextcloud.critical-mapping.net', 'nextcloud.ctrl-shift.net', 'nextcloud.dapor.org', 'nextcloud.darkkirb.de', @@ -39229,6 +39268,7 @@ 'nextcloud.diblasio.net', 'nextcloud.dir.pl', 'nextcloud.dunnette.us', + 'nextcloud.emjucaba.duckdns.org', 'nextcloud.englishup.me', 'nextcloud.fnukhosting.net', 'nextcloud.foerster-ffm.de', @@ -43717,6 +43757,7 @@ 'plaza.vapor.fm', 'plaza.vaporpolis.net', 'pld.tf', + 'ple.bal.ovh', 'ple.emtee.xyz', 'ple.happytoo.cyou', 'ple.kizzkey.cloud', @@ -47795,6 +47836,7 @@ 'salmon.nigiri.dev', 'salmonella.tk', 'salocha.online', + 'salon.algorithmicpattern.org', 'salon.cutefox.gay', 'salon.fika.moe', 'salon.literatur.social', @@ -49443,6 +49485,7 @@ 'soapboxsongs.wordpress.com', 'soatok.blog', 'soba.gentoo.app', + 'soberveganwarrior.com', 'sobieck.social', 'sobieski.social', 'sobkowicz.org', @@ -52214,6 +52257,7 @@ 'social.lindsaybison.com', 'social.linke-schueler.de', 'social.linksfraktion.de', + 'social.linkwaveconnect.com.br', 'social.lino.cooking', 'social.linss.com', 'social.linu.xxx', @@ -53779,6 +53823,7 @@ 'social.spicyweb.dev', 'social.spiegelslust.xyz', 'social.spiezmaestro.ch', + 'social.spin.wtf', 'social.spiritofcontradiction.eu', 'social.spiwit.net', 'social.splat.soy', @@ -54625,6 +54670,7 @@ 'social.zeruhur.icu', 'social.zetaphor.com', 'social.zete.tk', + 'social.zeuke.me', 'social.zhongguotese.net', 'social.ziazoo.co.uk', 'social.ziez.eu', @@ -55283,6 +55329,7 @@ 'staf.dev', 'staff.msnic.jp', 'stage-mastodon.siegenthaler.mx', + 'stage.bassam.social', 'stage.ellemef.com', 'stage.epistolary.org', 'stage.moztodon.nonprod.webservices.mozgcp.net', @@ -56554,6 +56601,7 @@ 'tappenden.social', 'taprlight.com', 'taproot.social', + 'taps.good-eris.net', 'tara.social', 'tarakka.fi', 'tarale.fedipress.au', @@ -64880,4 +64928,4 @@ 'zzz.rocks', 'zzzoy2o6.activitypub-troll.cf', 'zzzxxx.xyz', -} +} \ No newline at end of file