Skip to content

Commit

Permalink
Break long domains up to placate flake8.
Browse files Browse the repository at this point in the history
This is silly. I should just be writing these to a file.
  • Loading branch information
colons committed Nov 7, 2023
1 parent b4ca860 commit a9701ce
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 7 deletions.
23 changes: 21 additions & 2 deletions nkdsu/apps/vote/management/commands/update_mastodon_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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])
Expand Down
58 changes: 53 additions & 5 deletions nkdsu/apps/vote/mastodon_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -8490,6 +8497,7 @@
'asse.world',
'assemblag.es',
'assemblylabx.com',
'assetsfolder.nohost.me',
'assilvestrar.club',
'asso.lgbt',
'associated.social',
Expand Down Expand Up @@ -10640,6 +10648,7 @@
'blogsquad.social',
'blogue.narf.ca',
'blogueur-de-france.fr',
'blogz.zaclys.com',
'blombus.com',
'bloodandthunderleviathan.herokuapp.com',
'bloodmountain.herokuapp.com',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -13599,6 +13609,7 @@
'cote.io',
'cotellese.net',
'cotix.gg',
'cottoncandy.cafe',
'couch.beerriot.com',
'cough.reitrace.ga',
'couldbe.art',
Expand Down Expand Up @@ -15256,6 +15267,7 @@
'dispatches.fm',
'disperfected.com',
'displaced.social',
'display.whenpeople.live',
'displayeurope.social',
'displeu.dev.osalliance.com',
'disputemag.com',
Expand Down Expand Up @@ -16362,6 +16374,7 @@
'ejls.fr',
'ek62e7g0.activitypub-troll.cf',
'eka.rodeo',
'ekdnam-shuttlecraft.glitch.me',
'ekho.nullzone.fr',
'ekimemo.info',
'ekklisia.kleio.dev',
Expand Down Expand Up @@ -16401,6 +16414,7 @@
'electricglen.com',
'electricjidam.zyr8wwlkbp8mi196.myfritz.net',
'electrickite.org',
'electricmonk.de',
'electricmonk.social',
'electricpaper.love',
'electricpea.ch',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -18248,6 +18263,7 @@
'fedilemmy.net',
'fedilists.com',
'fedilove.cyou',
'fedimagazine.tokyo',
'fedimaker.space',
'fedimarks.glitch.me',
'fedimas.com',
Expand Down Expand Up @@ -18404,6 +18420,7 @@
'fediverser.communick.dev',
'fediversereport.com',
'fediversity.site',
'fediverso.bakunin.nohost.me',
'fediverso.club',
'fediverso.manualdousuario.net',
'fediverso.net',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -21365,6 +21383,7 @@
'gruezi.net',
'gruifor.eu',
'grumble.social',
'grumbleflap.shannonmcmaster.com',
'grumpy-snake-45.loca.lt',
'grumpyoldme.de',
'grumpys.online',
Expand Down Expand Up @@ -22095,6 +22114,7 @@
'headpats.cafe',
'headphone.actor',
'heads.social',
'healingwithyessie.com',
'healthcode.cloud',
'heapoverflow.ml',
'hear-me.social',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -30585,6 +30618,7 @@
'mastodon.brnrs.pl',
'mastodon.brodi.space',
'mastodon.browarski.de',
'mastodon.brunovianna.net',
'mastodon.brussels',
'mastodon.bryce.co',
'mastodon.bstly.de',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -34708,6 +34743,7 @@
'meetbeauties.social',
'meetiko.org',
'meetplay.net',
'meetups.infosec.exchange',
'meetwoof.com',
'meety.me',
'mefi.social',
Expand Down Expand Up @@ -34970,7 +35006,6 @@
'mexico-pensante.blog',
'mexico.spacepatrol.org',
'mexicosocial.mx',
'mf1.social',
'mfc19.wordpress.com',
'mfg.fyi',
'mfjt-gotosocial.fly.dev',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -38259,6 +38296,7 @@
'murder.town',
'murf.org',
'murffys-place.club',
'muri.muri.zip',
'muri.network',
'murmf.art',
'murmur.masto.host',
Expand Down Expand Up @@ -39222,13 +39260,15 @@
'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',
'nextcloud.devonrjohnson.stream',
'nextcloud.diblasio.net',
'nextcloud.dir.pl',
'nextcloud.dunnette.us',
'nextcloud.emjucaba.duckdns.org',
'nextcloud.englishup.me',
'nextcloud.fnukhosting.net',
'nextcloud.foerster-ffm.de',
Expand Down Expand Up @@ -43717,6 +43757,7 @@
'plaza.vapor.fm',
'plaza.vaporpolis.net',
'pld.tf',
'ple.bal.ovh',
'ple.emtee.xyz',
'ple.happytoo.cyou',
'ple.kizzkey.cloud',
Expand Down Expand Up @@ -47795,6 +47836,7 @@
'salmon.nigiri.dev',
'salmonella.tk',
'salocha.online',
'salon.algorithmicpattern.org',
'salon.cutefox.gay',
'salon.fika.moe',
'salon.literatur.social',
Expand Down Expand Up @@ -49443,6 +49485,7 @@
'soapboxsongs.wordpress.com',
'soatok.blog',
'soba.gentoo.app',
'soberveganwarrior.com',
'sobieck.social',
'sobieski.social',
'sobkowicz.org',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -56554,6 +56601,7 @@
'tappenden.social',
'taprlight.com',
'taproot.social',
'taps.good-eris.net',
'tara.social',
'tarakka.fi',
'tarale.fedipress.au',
Expand Down Expand Up @@ -64880,4 +64928,4 @@
'zzz.rocks',
'zzzoy2o6.activitypub-troll.cf',
'zzzxxx.xyz',
}
}

0 comments on commit a9701ce

Please sign in to comment.