nkdsu.apps.vote package#

Subpackages#

Submodules#

nkdsu.apps.vote.admin module#

class nkdsu.apps.vote.admin.UserAdmin(model, admin_site)[source]#

Bases: UserAdmin

list_display = ('username', 'display_name', 'email', 'is_elf', 'is_staff', 'is_superuser', 'has_usable_password')#
display_name(obj: User) str[source]#
is_elf(obj: User) bool[source]#
has_usable_password(obj: User) bool[source]#
property media#
class nkdsu.apps.vote.admin.ShowAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('showtime', 'end', 'voting_allowed')#
property media#
class nkdsu.apps.vote.admin.TwitterUserAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('screen_name', 'is_abuser', 'is_patron')#
list_filter = ('is_abuser', 'is_patron')#
property media#
class nkdsu.apps.vote.admin.UserBadgeAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('profile', 'twitter_user', 'badge')#
list_filter = ('profile', 'twitter_user', 'badge')#
property media#
class nkdsu.apps.vote.admin.VoteAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('__str__', 'date', 'vote_kind')#
list_filter = ('kind', 'twitter_user')#
filter_horizontal = ('tracks',)#
property media#
class nkdsu.apps.vote.admin.TrackAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('id3_title', 'id3_artist')#
property media#
class nkdsu.apps.vote.admin.PlayAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('track', 'date')#
property media#
class nkdsu.apps.vote.admin.BlockAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('track', 'reason', 'show')#
property media#
class nkdsu.apps.vote.admin.DiscardShortlistAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('track', 'show')#
property media#
class nkdsu.apps.vote.admin.ProfileAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('__str__', 'is_patron', 'is_abuser')#
username(obj: Profile) str[source]#
property media#
class nkdsu.apps.vote.admin.RequestAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('created', 'filled_by', 'claimant', 'submitted_by')#
list_filter = ('filled_by', 'claimant', 'submitted_by')#
property media#
class nkdsu.apps.vote.admin.NoteAdmin(model, admin_site)[source]#

Bases: ModelAdmin

list_display = ('track', 'show', 'public', 'content')#
property media#

nkdsu.apps.vote.anime module#

class nkdsu.apps.vote.anime.Season[source]#

Bases: TypedDict

year: int | None#
season: Literal['WINTER', 'SPRING', 'SUMMER', 'FALL', 'UNDEFINED']#
class nkdsu.apps.vote.anime.Anime(*, title: str, picture: Url, thumbnail: Url, synonyms: list[str], sources: list[Url], relations: list[Url], anime_season: Season, type: Literal['MOVIE', 'ONA', 'OVA', 'SPECIAL', 'TV', 'UNKNOWN'])[source]#

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {'frozen': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

title: str#
picture: HttpUrl#
thumbnail: HttpUrl#
synonyms: list[str]#
sources: list[HttpUrl]#
relations: list[HttpUrl]#
anime_season: Season#
type: Literal['MOVIE', 'ONA', 'OVA', 'SPECIAL', 'TV', 'UNKNOWN']#
property quarter: str#
cached_picture_filename() str[source]#
cached_picture_path() str[source]#
picture_is_cached() bool[source]#
cached_picture_url(force_refresh: bool = False) str[source]#
cache_picture() None[source]#
titles() list[str][source]#
inclusion_ranking() tuple[int, float][source]#

Return an estimated representation of how likely this anime is to be something in the library, in the form of a tuple of numbers that you can sort by. Helpful for situations where we have multiple matches for the same name. Lower is more likely.

urls() list[tuple[str, Url]][source]#
related_anime() list[str][source]#
_abc_impl = <_abc._abc_data object>#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_fields: ClassVar[dict[str, FieldInfo]] = {'anime_season': FieldInfo(annotation=Season, required=True), 'picture': FieldInfo(annotation=Url, required=True, metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]), 'relations': FieldInfo(annotation=list[Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]], required=True), 'sources': FieldInfo(annotation=list[Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]], required=True), 'synonyms': FieldInfo(annotation=list[str], required=True), 'thumbnail': FieldInfo(annotation=Url, required=True, metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]), 'title': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=Literal['MOVIE', 'ONA', 'OVA', 'SPECIAL', 'TV', 'UNKNOWN'], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

nkdsu.apps.vote.anime.get_anime(title: str) Anime | None[source]#
>>> get_anime('Machikado Mazoku').title
'Machikado Mazoku'
>>> get_anime('The Demon Girl Next Door').title
'Machikado Mazoku'
>>> get_anime('shamiko')
nkdsu.apps.vote.anime.fuzzy_nkdsu_aliases() dict[str, str][source]#

Return a dict of {alias: nkdsu_title} where nkdsu_title is an anime included in the nkd.su database, and alias is a lowercased alternative title for the nkdsu_title it points to.

>>> from pprint import pprint
>>> from nkdsu.apps.vote.models import Track
>>> from django.utils.timezone import now
>>> defaults = dict(
...     id3_artist='someone', hidden=False, inudesu=False, added=now(), revealed=now()
... )

With some anime titles that don’t have very many synonyms:

>>> Track.objects.create(**defaults, id='1', id3_title='song (Eiji OP1)')
<Track: ‘song’ (Eiji OP1) - someone>
>>> Track.objects.create(**defaults, id='2', id3_title='ditty (◯ ED1)')
<Track: ‘ditty’ (◯ ED1) - someone>
>>> pprint(fuzzy_nkdsu_aliases())
{'"eiji"': 'Eiji',
 'circle': '◯',
 'eiji': 'Eiji',
 'o (sawako kabuki)': '◯',
 '°': '◯',
 '○': '◯',
 '◯': '◯',
 '「エイジ」': 'Eiji',
 'エイジ': 'Eiji'}
nkdsu.apps.vote.anime.suggest_anime(query: str) set[str][source]#

nkdsu.apps.vote.api_utils module#

class nkdsu.apps.vote.api_utils.SerializableModelMeta(name, bases, namespace, /, **kwargs)[source]#

Bases: _ProtocolMeta, ModelBase

class nkdsu.apps.vote.api_utils.SerializableBase(*args, **kwargs)[source]#

Bases: Protocol

api_dict(verbose: bool = False) dict[str, None | bool | int | float | str | datetime | dict[str, None | bool | int | float | str | datetime | dict[str, JsonEncodable] | list[JsonEncodable]] | list[None | bool | int | float | str | datetime | dict[str, JsonEncodable] | list[JsonEncodable]]][source]#
_abc_impl = <_abc._abc_data object>#
_is_protocol = True#
class nkdsu.apps.vote.api_utils.Serializable(*args, **kwargs)[source]#

Bases: SerializableBase, Model

class Meta[source]#

Bases: object

abstract = False#
_abc_impl = <_abc._abc_data object>#
_is_protocol = False#
_meta = <Options for Serializable>#

nkdsu.apps.vote.apps module#

class nkdsu.apps.vote.apps.VoteConfig(app_name, app_module)[source]#

Bases: AppConfig

name = 'nkdsu.apps.vote'#
ready() None[source]#

nkdsu.apps.vote.context_processors module#

nkdsu.apps.vote.context_processors.get_sections(request)[source]#
nkdsu.apps.vote.context_processors.get_pending_requests(request: HttpRequest) QuerySet[source]#
nkdsu.apps.vote.context_processors.get_parent(request: HttpRequest) str[source]#
nkdsu.apps.vote.context_processors.get_dark_mode(request: HttpRequest)[source]#
nkdsu.apps.vote.context_processors.nkdsu_context_processor(request: HttpRequest) dict[str, Any][source]#

Add common stuff to context.

nkdsu.apps.vote.elfs module#

nkdsu.apps.vote.elfs.ELFS_NAME = 'Elfs'#

The name of the group that elfs belong to

nkdsu.apps.vote.elfs.is_elf(user: User | AnonymousUser) bool[source]#

Return True if user is an elf.

nkdsu.apps.vote.emoji module#

nkdsu.apps.vote.emoji._get_emoji() Iterable[str][source]#

nkdsu.apps.vote.forms module#

class nkdsu.apps.vote.forms.ClearableFileInput(attrs=None)[source]#

Bases: ClearableFileInput

The stock clearable file widget generates HTML that cannot be easily laid out in a reasonable way with CSS. In particular, the way the ‘clear’ checkbox is not put in any kind of elements makes intentional layout basically impossible. Here, we aim to fix that.

template_name = 'widgets/clearable_file_input.html'#
property media#
class nkdsu.apps.vote.forms.SearchForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#

Bases: Form

base_fields = {'q': <django.forms.fields.CharField object>}#
declared_fields = {'q': <django.forms.fields.CharField object>}#
property media#
class nkdsu.apps.vote.forms.TriviaForm(*args, **kwargs)[source]#

Bases: Form

A form protected by a trivia question.

new_question() str[source]#
clean_trivia()[source]#
base_fields = {'trivia': <django.forms.fields.CharField object>, 'trivia_question': <django.forms.fields.CharField object>}#
declared_fields = {'trivia': <django.forms.fields.CharField object>, 'trivia_question': <django.forms.fields.CharField object>}#
property media#
class nkdsu.apps.vote.forms.BadMetadataForm(*args, track: Track, **kwargs)[source]#

Bases: Form

track: Track#
base_fields = {'details': <django.forms.fields.CharField object>}#
declared_fields = {'details': <django.forms.fields.CharField object>}#
property media#
class nkdsu.apps.vote.forms.RequestForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#

Bases: Form

A form for requesting that a track be added to the library.

clean() dict[str, Any] | None[source]#
base_fields = {'artist': <django.forms.fields.CharField object>, 'details': <django.forms.fields.CharField object>, 'role': <django.forms.fields.CharField object>, 'show': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
declared_fields = {'artist': <django.forms.fields.CharField object>, 'details': <django.forms.fields.CharField object>, 'role': <django.forms.fields.CharField object>, 'show': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
property media#
class nkdsu.apps.vote.forms.VoteForm(*args, tracks: Sequence[Track], **kwargs)[source]#

Bases: ModelForm

A form for creating a models.Vote.

class Meta[source]#

Bases: object

model#

alias of Vote

fields = ['text']#
widgets = {'text': <django.forms.widgets.TextInput object>}#
tracks: Sequence[Track]#
clean() None[source]#
_meta = <django.forms.models.ModelFormOptions object>#
base_fields = {'text': <django.forms.fields.CharField object>}#
declared_fields = {}#
property media#
class nkdsu.apps.vote.forms.CheckMetadataForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#

Bases: Form

base_fields = {'composer': <django.forms.fields.CharField object>, 'id3_artist': <django.forms.fields.CharField object>, 'id3_title': <django.forms.fields.CharField object>, 'year': <django.forms.fields.IntegerField object>}#
declared_fields = {'composer': <django.forms.fields.CharField object>, 'id3_artist': <django.forms.fields.CharField object>, 'id3_title': <django.forms.fields.CharField object>, 'year': <django.forms.fields.IntegerField object>}#
property media#
class nkdsu.apps.vote.forms.LibraryUploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#

Bases: Form

base_fields = {'inudesu': <django.forms.fields.BooleanField object>, 'library_xml': <django.forms.fields.FileField object>}#
declared_fields = {'inudesu': <django.forms.fields.BooleanField object>, 'library_xml': <django.forms.fields.FileField object>}#
property media#
class nkdsu.apps.vote.forms.MyriadExportUploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#

Bases: Form

base_fields = {'myriad_csv': <django.forms.fields.FileField object>}#
declared_fields = {'myriad_csv': <django.forms.fields.FileField object>}#
property media#
class nkdsu.apps.vote.forms.NoteForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]#

Bases: ModelForm

class Meta[source]#

Bases: object

model#

alias of Note

fields = ['content', 'public']#
_meta = <django.forms.models.ModelFormOptions object>#
base_fields = {'content': <django.forms.fields.CharField object>, 'just_for_current_show': <django.forms.fields.BooleanField object>, 'public': <django.forms.fields.BooleanField object>}#
declared_fields = {'just_for_current_show': <django.forms.fields.BooleanField object>}#
property media#
class nkdsu.apps.vote.forms.DarkModeForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]#

Bases: Form

base_fields = {'mode': <django.forms.fields.ChoiceField object>}#
declared_fields = {'mode': <django.forms.fields.ChoiceField object>}#
property media#

nkdsu.apps.vote.managers module#

class nkdsu.apps.vote.managers.NoteQuerySet(model=None, query=None, using=None, hints=None)[source]#

Bases: QuerySet

for_show_or_none(show: Show) models.QuerySet[Note][source]#
class nkdsu.apps.vote.managers.TrackQuerySet(model=None, query=None, using=None, hints=None)[source]#

Bases: QuerySet

_everything(show_secret_tracks: bool = False) TrackQuerySet[source]#
for_decade(start_year: int) TrackQuerySet[source]#
public() TrackQuerySet[source]#
by_artist(artist: str, show_secret_tracks: bool = False) list[Track][source]#

Filters with Python, so does not return a queryset and is not lazy.

by_composer(composer: str, show_secret_tracks: bool = False) list[Track][source]#
by_anime(anime: str, show_secret_tracks: bool = False) list[Track][source]#

Behaves similarly to by_artist.

search(query: str, show_secret_tracks: bool = False) TrackQuerySet[source]#

nkdsu.apps.vote.mastodon_instances module#

nkdsu.apps.vote.mastodon_instances._get_mastodon_instances() set[str][source]#

nkdsu.apps.vote.mixcloud module#

nkdsu.apps.vote.mixcloud._get_cloudcasts()[source]#
nkdsu.apps.vote.mixcloud.cloudcasts_for(date) list[Any][source]#

nkdsu.apps.vote.mixins module#

class nkdsu.apps.vote.mixins.CurrentShowMixin[source]#

Bases: ContextMixin

get_context_data(**kwargs) dict[str, Any][source]#
class nkdsu.apps.vote.mixins.LetMemoizeGetObject[source]#

Bases: SingleObjectMixin

A view mixin that allows objects to be memoized if, and only if, the base queryset is not overridden, so we can be confident that sequential retrievals would have been the same.

Helpful for views where get_object() is particularly expensive.

get_object(queryset: QuerySet | None = None) M[source]#
abstract get_memoizable_object() M[source]#
class nkdsu.apps.vote.mixins.TrackListWithAnimeGrouping[source]#

Bases: ContextMixin

get_track_queryset() Sequence[Track] | TrackQuerySet[source]#
grouped_tracks() OrderedDict[str, list[Track]][source]#
get_context_data(**kwargs) dict[str, Any][source]#
class nkdsu.apps.vote.mixins.TrackListWithAnimeGroupingListView(**kwargs)[source]#

Bases: TrackListWithAnimeGrouping, ListView

get_queryset() Sequence[Track] | TrackQuerySet[source]#
class nkdsu.apps.vote.mixins.ShowDetailMixin[source]#

Bases: LetMemoizeGetObject

A view that will find a show for any date in the past, redirect to the showtime date if necessary, and then render a view with the correct show in context.

model#

alias of Show

view_name: str | None = None#
default_to_current = False#
date: datetime | None = None#
get_memoizable_object() Show[source]#

Get the show relating to date or, if date is None, the most recent complete show. If self.default_to_current is True, get the show in progress rather than the most recent complete show.

Doesn’t use Show.at() because I don’t want views creating Show instances in the database.

get(request: HttpRequest, *args, **kwargs) HttpResponse[source]#
get_context_data(**kwargs) dict[str, Any][source]#
class nkdsu.apps.vote.mixins.ThisShowDetailMixin[source]#

Bases: ShowDetailMixin

Like ShowDetailMixin, but defaults to the show in progress when no date is provided.

get_object(queryset: QuerySet | None = None) Show[source]#
class nkdsu.apps.vote.mixins.ShowDetail(**kwargs)[source]#

Bases: ShowDetailMixin, DetailView

model#

alias of Show

object: Show#
class nkdsu.apps.vote.mixins.ArchiveList(**kwargs)[source]#

Bases: ListView

model#

alias of Show

exclude_current = True#
year() int[source]#
get_years() list[int][source]#
get_queryset() QuerySet[source]#
get_context_data(**kwargs) dict[str, Any][source]#
class nkdsu.apps.vote.mixins.TwitterUserDetailMixin[source]#

Bases: LetMemoizeGetObject

model#

alias of TwitterUser

get_memoizable_object() TwitterUser[source]#
class nkdsu.apps.vote.mixins.BreadcrumbMixin[source]#

Bases: object

breadcrumbs: list[tuple[str | None, str]] = []#
abstract get_breadcrumbs() list[tuple[str | None, str]][source]#
get_context_data(**k)[source]#
class nkdsu.apps.vote.mixins.BrowseCategory(**kwargs)[source]#

Bases: BreadcrumbMixin, TemplateView

template_name = 'browse_category.html'#
context_category_name = 'items'#
category_name: str | None = None#
breadcrumbs: list[tuple[str | None, str]] = [('/browse/', 'browse')]#
contents_required = True#
searchable = True#
abstract get_categories() Iterable[BrowsableItem][source]#
filter_categories(items: Iterable[BrowsableItem]) Iterable[BrowsableItem][source]#
get_context_data(**kwargs) dict[str, Any][source]#

nkdsu.apps.vote.models module#

class nkdsu.apps.vote.models.CleanOnSaveMixin[source]#

Bases: object

save(*args, **kwargs)[source]#
class nkdsu.apps.vote.models.SetShowBasedOnDateMixin[source]#

Bases: object

show: ForeignKey#
save(*args, **kwargs)[source]#
class nkdsu.apps.vote.models.Show(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Serializable, Model

A broadcast of the show and, by extention, the week leading up to it.

showtime#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

message#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

voting_allowed#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

clean() None[source]#
classmethod current(*a, **k) Any#
classmethod _at(time: datetime, create: bool = True) Show | None[source]#

Get (or create, if necessary) the show for time. Use .at() instead.

classmethod at(time: datetime) Show[source]#

Get the show for the date specified, creating every intervening show in the process if necessary.

broadcasting(time: datetime | None = None) bool[source]#

Return True if the time specified is during this week’s show.

next(*a, **k)#
prev(*a, **k)#
has_ended() bool[source]#
_date_kwargs(attr: str = 'date') dict[str, datetime][source]#

The kwargs you would hand to a queryset to find objects applicable to this show. Should not be used unless you’re doing something that can’t use a .show ForeignKey.

votes() QuerySet[source]#
plays() QuerySet[source]#
playlist() list[Track][source]#
shortlisted() list[Track][source]#
discarded() list[Track][source]#
tracks_sorted_by_votes(*a, **k)#
revealed(*a, **k)#
cloudcasts(*a, **k)#
get_absolute_url() str[source]#
get_listen_url() str[source]#
get_revealed_url() str[source]#
property start: datetime | None#
api_dict(verbose: bool = False) JsonDict[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_abc_impl = <_abc._abc_data object>#
_is_protocol = False#
_meta = <Options for Show>#
block_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

discard_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_next_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=True, **kwargs)#
get_next_by_showtime(*, field=<django.db.models.fields.DateTimeField: showtime>, is_next=True, **kwargs)#
get_previous_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=False, **kwargs)#
get_previous_by_showtime(*, field=<django.db.models.fields.DateTimeField: showtime>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

note_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>#
play_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

proroulettecommitment_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

shortlist_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

vote_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class nkdsu.apps.vote.models.TwitterUser(id, screen_name, user_id, name, is_patron, is_abuser, updated)[source]#

Bases: Voter, CleanOnSaveMixin, Model

is_twitteruser = True#
screen_name#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name: str | CharField#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_patron: bool | BooleanField#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_abuser: bool | BooleanField#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

updated#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property username: str#
_twitter_user_and_profile() tuple[TwitterUser | None, Profile | None][source]#
twitter_url() str[source]#
get_absolute_url() str[source]#
get_toggle_abuser_url() str[source]#
get_avatar_url(try_profile: bool = True) str[source]#
unordered_votes() QuerySet[source]#
api_dict(verbose: bool = False) JsonDict[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_abc_impl = <_abc._abc_data object>#
_is_protocol = False#
_meta = <Options for TwitterUser>#
get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)#
get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
profile#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

userbadge_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

vote_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

nkdsu.apps.vote.models.avatar_upload_path(instance: Profile, filename: str) str[source]#
class nkdsu.apps.vote.models.Profile(id, user, twitter_user, avatar, display_name, is_patron, is_abuser)[source]#

Bases: Voter, CleanOnSaveMixin, Model

user#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

twitter_user#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

avatar#

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

display_name#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_patron: bool | BooleanField#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_abuser: bool | BooleanField#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

_twitter_user_and_profile() tuple[TwitterUser | None, Profile | None][source]#
property username: str#
get_absolute_url() str[source]#
get_avatar_url() str[source]#
unordered_votes() QuerySet[source]#
property name: str#
get_toggle_abuser_url() str[source]#
has_max_websites() bool[source]#
get_websites() Iterable[UserWebsite][source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_abc_impl = <_abc._abc_data object>#
_is_protocol = False#
_meta = <Options for Profile>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
twitter_user_id#
user_id#
userbadge_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

websites#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class nkdsu.apps.vote.models.UserWebsite(id, url, profile)[source]#

Bases: CleanOnSaveMixin, Model

url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

profile#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

clean() None[source]#
property kind: Literal['_website', 'anilist', 'bsky', 'cohost', 'facebook', 'instagram', 'linkedin', 'mastodon', 'myanimelist', 'nkdsu', 'threads', 'tumblr', 'twitch', 'twitter', 'x', 'youtube']#

Return an appropriate identify for for what kind of URL this is.

>>> UserWebsite(url='https://someone.tumblr.com').kind
'tumblr'
>>> UserWebsite(url='https://tumblr.com/someone').kind
'tumblr'
>>> UserWebsite(url='https://cohost.org/someone').kind
'cohost'
>>> UserWebsite(url='https://www.instagram.com/someone').kind
'instagram'
>>> UserWebsite(url='https://plush.city/@someone').kind
'mastodon'
>>> UserWebsite(url='https://website.tld').kind
'_website'
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for UserWebsite>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
profile_id#
class nkdsu.apps.vote.models.UserTrackList(id, user, name, description, public, icon)[source]#

Bases: CleanOnSaveMixin, Model

user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

name#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

public#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

icon#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tracks: ManyToManyField#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_absolute_url() str[source]#
playlist() Iterable[Track][source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for UserTrackList>#
get_icon_display(*, field=<django.db.models.fields.CharField: icon>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
user_id#
usertracklisttrack_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class nkdsu.apps.vote.models.UserTrackListTrack(id, track, track_list, index)[source]#

Bases: CleanOnSaveMixin, Model

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

track_list#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

index#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs) None[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for UserTrackListTrack>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
track_id#
track_list_id#
nkdsu.apps.vote.models.art_path(i: Track, f: str) str[source]#
class nkdsu.apps.vote.models.Role(full_tag: str)[source]#

Bases: object

caveat: str | None = None#
anime: str | None#
full_role: str#
kind: str = ''#
specifics: str = ''#
sortkey_group: float#
numbers_in_role() tuple[int, ...][source]#
sortkey() tuple[float, str, tuple[int, ...], str][source]#
anime_data() Anime | None[source]#
related_anime() list[str][source]#
class nkdsu.apps.vote.models.Track(id, id3_title, id3_artist, id3_album, msec, added, composer, label, year, media_id, has_hook, revealed, archived, hidden, inudesu, background_art, metadata_locked)[source]#

Bases: CleanOnSaveMixin, Serializable, Model

objects = <django.db.models.manager.ManagerFromTrackQuerySet object>#
note_set: RelatedManager[Note]#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

play_set: RelatedManager[Play]#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

vote_set: RelatedManager[Vote]#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id3_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id3_artist#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id3_album#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

msec#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

added#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

composer#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

label#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

year#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

media_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

has_hook#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

revealed#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

archived#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

hidden#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

inudesu#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

background_art#

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

metadata_locked#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

clean() None[source]#
classmethod all_anime_titles() set[str][source]#
classmethod all_artists() set[str][source]#
classmethod all_composers() set[str][source]#
classmethod all_years() list[int][source]#
classmethod complete_decade_range() list[tuple[int, bool]][source]#
classmethod all_decades() list[int][source]#
classmethod suggest_artists(string: str) set[str][source]#
classmethod all_roles(qs: QuerySet | None = None) set[str][source]#
classmethod all_public_roles() set[str][source]#
is_new() bool[source]#
show_revealed() Show | None[source]#

Return the show that this track was revealed for.

length_str() str[source]#
last_play() Play | None[source]#
plays() QuerySet[source]#
plays_newest_first() QuerySet[source]#
weeks_since_play() int | None[source]#

Get the number of weeks since this track’s last Play.

property title: str#
property album: str#
property role: str | None#
property roles: list[str]#
property role_details: list[Role]#
role_details_for_anime(anime: str) list[Role][source]#
has_anime(anime: str) bool[source]#
property artist: str#
artists(*a, **k)#
artist_names(fail_silently: bool = True) Iterable[str][source]#
composers(*a, **k)#
composer_names(fail_silently: bool = True) Iterable[str][source]#
split_id3_title() tuple[str, str | None][source]#
eligible() bool[source]#

Returns True if this track can be requested.

ineligible() str | None[source]#

Return a string describing why a track is ineligible, or None if it is not.

votes_for(*a, **k)#
notes() NoteQuerySet[source]#
public_notes() NoteQuerySet[source]#
visible_track_lists() QuerySet[source]#
play_tweet_content() str[source]#
play_tweet_intent_url() str[source]#
play() Play[source]#

Mark this track as played.

shortlist() None[source]#
discard() None[source]#
reset_shortlist_discard() None[source]#
archive() None[source]#
unarchive() None[source]#
hide() None[source]#
unhide() None[source]#
lock_metadata() None[source]#
unlock_metadata() None[source]#
slug() str[source]#
get_absolute_url() str[source]#
get_public_url() str[source]#
get_report_url() str[source]#
get_vote_url() str[source]#

Return the url for voting for this track alone.

get_lastfm_track() dict[str, Any][source]#
musicbrainz_release(*a, **k)#
_get_lastfm_album_from_album_tag() dict[str, Any] | None[source]#
_get_lastfm_album_from_musicbrainz_release() dict[str, Any] | None[source]#
_get_lastfm_album_from_track_tag() dict[str, Any] | None[source]#
get_lastfm_album() dict[str, Any] | None[source]#
get_lastfm_artist() dict[str, Any] | None[source]#
get_biggest_lastfm_image_url() str | None[source]#
update_background_art() None[source]#
api_dict(verbose: bool = False) JsonDict[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_abc_impl = <_abc._abc_data object>#
_is_protocol = False#
_meta = <Options for Track>#
block_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

discard_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)#
get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)#
proroulettecommitment_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

request_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

shortlist_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

usertracklist_set#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

usertracklisttrack_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

nkdsu.apps.vote.models.MANUAL_VOTE_KINDS = (('email', 'email'), ('discord', 'discord'), ('text', 'text'), ('tweet', 'tweet'), ('person', 'in person'), ('phone', 'on the phone'))#

The kinds of vote that can be imported manually

class nkdsu.apps.vote.models.VoteKind(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

local = 1#

A request made using the website’s built-in requesting machinery.

twitter = 2#

A historical request, initially derived from a tweet we received via the Twitter API.

manual = 3#

A request manually created by an admin to reflect, for example, an email.

class nkdsu.apps.vote.models.Vote(id, date, show, text, user, twitter_user, tweet_id, name, kind)[source]#

Bases: SetShowBasedOnDateMixin, CleanOnSaveMixin, Model

tracks: ManyToManyField#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

show: ForeignKey#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

text#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

twitter_user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

tweet_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kind#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

clean() None[source]#
property vote_kind: VoteKind#
property is_twitter: bool#
property is_manual: bool#
property is_local: bool#
property is_editable: bool#
get_image_url() str[source]#
property voter: Voter | None#
content() str[source]#

Return the non-mention, non-url content of the text.

birthday() bool[source]#
property hat: UserBadge | None#

Get the most important badge for a given vote, where the most important badge is the last one defined in BADGES that we are currently within the time range of.

success(*a, **k)#
weight(*a, **k)#
api_dict(verbose: bool = False) JsonDict[source]#
twitter_url() str | None[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Vote>#
get_kind_display(*, field=<django.db.models.fields.CharField: kind>)#
get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)#
get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
show_id#
twitter_user_id#
user_id#
class nkdsu.apps.vote.models.Play(*args, **kwargs)[source]#

Bases: SetShowBasedOnDateMixin, CleanOnSaveMixin, Model

A record that a Track was played on the show.

date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

show: ForeignKey#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

tweet_id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

clean() None[source]#
save(*args, **kwargs) None[source]#
api_dict(verbose: bool = False) JsonDict[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Play>#
get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)#
get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
show_id#
track_id#
class nkdsu.apps.vote.models.Block(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Model

A particular track that we are not going to allow to be voted for on particular show.

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reason#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

show#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Block>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
show_id#
track_id#
class nkdsu.apps.vote.models.Shortlist(id, show, track, index)[source]#

Bases: CleanOnSaveMixin, Model

show#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

index#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

take_first_available_index() None[source]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Shortlist>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
show_id#
track_id#
class nkdsu.apps.vote.models.Discard(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Model

A track that we’re not going to play, but that we don’t want to make public that we’re not going to play.

show#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Discard>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
show_id#
track_id#
class nkdsu.apps.vote.models.Request(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Model

A request for a database addition or modification.

METADATA_KEYS = ['trivia', 'trivia_question', 'contact']#

keys of blob that no longer get set, but which may exist on historic Requests

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

blob#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

submitted_by#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

filled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

filled_by#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

claimant#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

serialise(struct)[source]#
struct()[source]#
non_metadata()[source]#
property active_shelving: ElfShelving | None#
property is_shelved: bool#
>>> from django.utils import timezone
>>> user = User.objects.create()
>>> request = Request(blob='{}')
>>> request.save()
>>> request.is_shelved
False
>>> shelving = ElfShelving.objects.create(request=request, created_by=user)
>>> del request.active_shelving  # to make @cached_property forget the cached response
>>> request.is_shelved
True
>>> shelving.disabled_at = timezone.now()
>>> shelving.save()
>>> del request.active_shelving
>>> request.is_shelved
False
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Request>#
claimant_id#
filled_by_id#
get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
shelvings#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

submitted_by_id#
track_id#
class nkdsu.apps.vote.models.ElfShelving(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Model

An expression by a elf that a Request cannot be filled at the moment.

request#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_at#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_by#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reason_created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disabled_at#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

disabled_by#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

reason_disabled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for ElfShelving>#
created_by_id#
disabled_by_id#
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)#
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
request_id#
class nkdsu.apps.vote.models.Note(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Model

A note about whatever for a particular track.

objects = <django.db.models.manager.ManagerFromNoteQuerySet object>#
track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

show#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

public#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

content#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for Note>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

show_id#
track_id#
class nkdsu.apps.vote.models.ProRouletteCommitment(*args, **kwargs)[source]#

Bases: CleanOnSaveMixin, Model

A commitment from a given user to only use Roulette in ‘pro’ mode until the current show ends. Retains the track they committed to and when the commitment was made.

show#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

track#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

created_at#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for ProRouletteCommitment>#
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)#
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
show_id#
track_id#
user_id#
class nkdsu.apps.vote.models.BadgeInfoForUser[source]#

Bases: TypedDict

slug: str#
description: str#
summary: str#
icon: str#
url: str#
start: datetime | None#
finish: datetime | None#
class nkdsu.apps.vote.models.Badge(slug: 'str', description_fmt: 'str', summary: 'str', icon: 'str', url: 'str', start: 'Optional[datetime.datetime]', finish: 'Optional[datetime.datetime]')[source]#

Bases: object

slug: str#
description_fmt: str#
summary: str#
icon: str#
url: str#
start: datetime | None#
finish: datetime | None#
info(user: Voter) BadgeInfoForUser[source]#
nkdsu.apps.vote.models.BADGES: list[Badge] = [Badge(slug='tblc', description_fmt='{name} bought Take Back Love City for the RSPCA.', summary='put up with bad music for animals', icon='headphones', url='https://desus.bandcamp.com/album/take-back-love-city', start=None, finish=datetime.datetime(1990, 1, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2016', description_fmt='{name} donated to the Very Scary Scenario charity streams for Special Effect in 2016.', summary='likes fun, hates exclusion', icon='heart', url='https://www.justgiving.com/fundraising/very-scary-scenario', start=datetime.datetime(2016, 10, 15, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2016, 11, 15, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2017', description_fmt='{name} donated to the Very Scary Scenario charity streams and Neko Desu All-Nighter for Cancer Research UK in 2017.', summary='likes depriving people of sleep, hates cancer', icon='heart', url='https://www.justgiving.com/fundraising/very-charity-scenario-2017', start=datetime.datetime(2017, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2017, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2018', description_fmt='{name} donated to the Very Scary Scenario charity streams for Cancer Research UK in 2018.', summary='likes depriving people of sleep, hates cancer', icon='medkit', url='https://www.justgiving.com/fundraising/very-charity-scenario-2018', start=datetime.datetime(2018, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2018, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2019', description_fmt='{name} donated to the Very Scary Scenario charity streams for Samaritans in 2019.', summary='likes depriving people of sleep, fan of good mental health', icon='life-ring', url='https://www.justgiving.com/fundraising/very-charity-scenario-2019', start=datetime.datetime(2019, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2019, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2020', description_fmt='{name} donated to the Very Scary Scenario charity streams for Cancer Research UK in 2020.', summary='donated to the 2020 Very Scary Scenario charity streams', icon='heartbeat', url='https://www.justgiving.com/fundraising/very-charity-scenario-2020', start=datetime.datetime(2020, 10, 1, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2020, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2021', description_fmt='{name} donated to the Very Scary Scenario charity streams for Mind in 2021.', summary='donated to the 2021 Very Scary Scenario charity streams', icon='brain', url='https://www.justgiving.com/fundraising/very-charity-scenario-2021', start=datetime.datetime(2021, 10, 9, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2021, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2022', description_fmt='{name} donated to the Very Scary Scenario charity streams for akt in 2022.', summary='donated to the 2022 Very Scary Scenario charity streams', icon='home', url='https://www.justgiving.com/fundraising/very-charity-scenario-2022', start=datetime.datetime(2022, 10, 9, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2022, 11, 27, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London'))), Badge(slug='charity-2023', description_fmt='{name} donated to the Very Scary Scenario charity streams and Neko Desu All-Nighter for the National Autistic Society in 2023.', summary='donated to the 2023 Very Scary Scenario charity streams', icon='infinity', url='https://www.justgiving.com/page/very-charity-scenario-2023', start=datetime.datetime(2023, 9, 9, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')), finish=datetime.datetime(2023, 12, 2, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/London')))]#

A list of accolades we can give to users for showing off on user pages and, during a specified time range, against every Vote they make.

class nkdsu.apps.vote.models.UserBadge(id, badge, twitter_user, profile)[source]#

Bases: CleanOnSaveMixin, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

_meta = <Options for UserBadge>#
get_badge_display(*, field=<django.db.models.fields.CharField: badge>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
profile_id#
twitter_user_id#
badge#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

twitter_user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

profile#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

classmethod for_voter(voter: Voter) QuerySet[source]#
clean() None[source]#
property badge_info: BadgeInfoForUser#

nkdsu.apps.vote.myriad_export module#

Tools for interacting with CSV exports of the library from Myriad Playout.

nkdsu.apps.vote.myriad_export.has_hook(entry: dict[str, str]) bool[source]#
class nkdsu.apps.vote.myriad_export.PlayoutEntry(item_type: str, media_id: int, title: str, artists: str)[source]#

Bases: object

item_type: str#
media_id: int#
title: str#
artists: str#
classmethod from_csv(entry: dict[str, str]) PlayoutEntry[source]#
matched_track() Track | None[source]#

Return the Track that matches this entry, if applicable.

update_matched_track() bool[source]#

Update and save the Track we’re able to match against this entry.

Returns:

True if we matched against something and updated it, otherwise False.

nkdsu.apps.vote.myriad_export.entries_for_file(file: Iterable[str]) Iterable[PlayoutEntry][source]#

nkdsu.apps.vote.parsers module#

class nkdsu.apps.vote.parsers.ArtistChunk(text: str, is_artist: bool)[source]#

Bases: object

text: str#
is_artist: bool#
property url: str | None#
property worth_linking_to: bool#
class nkdsu.apps.vote.parsers.ParsedArtist(chunks: list[nkdsu.apps.vote.parsers.ArtistChunk], should_collapse: bool)[source]#

Bases: object

chunks: list[ArtistChunk]#
should_collapse: bool#
class nkdsu.apps.vote.parsers.ArtistLexer[source]#

Bases: Lexer

tokens = {'ARTIST_COMPONENT', 'COMMA', 'CV', 'LPAREN', 'RPAREN', 'SPACE', 'SPECIAL_CASE', 'VIA'}#
SPECIAL_CASE = '^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$'#
VIA = "\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+"#
LPAREN = '(?<=\\s)\\('#
RPAREN = '\\)(?=\\s|,|\\)|$)'#
CV = '(CV[.:]|[Vv]ocals?:|[Mm]ain\\svocals?:|[Cc]omposed\\sby|[Ff]rom|[Ff]eat(\\.|uring)?|[Pp]erformed\\sby|Vo\\.)\\s+|='#
COMMA = ',(\\sand)?\\s+'#
SPACE = '\\s+'#
ARTIST_COMPONENT = "(\\(K\\)NoW_NAME|AKIMA & NEOS|ANNA TSUCHIYA inspi\\' NANA\\(BLACK STONES\\)|Bird Bear Hare and Fish|Bread & Butter|Carole\\s&\\sTuesday|Daisy x Daisy|Dejo & Bon|Digz, Inc. Group|Dimitri From Paris|Eunsol\\(1008\\)|Fear,\\sand\\sLoathing\\sin\\sLas\\sVegas|GENERATIONS from EXILE TRIBE|HIGH and MIGHTY COLOR|Hello, Happy World!|Hifumi,inc\\.|Kamisama, Boku wa Kizuite shimatta|Kevin & Cherry|King & Queen|Kisida Kyodan & The Akebosi Rockets|Konya, Anomachikara|Louis Armstrong and His Orchestra|MYTH\\s&\\sROID|OLIVIA inspi\\' REIRA\\(TRAPNEST\\)|Oranges\\s(and|&)\\sLemons|Rough & Ready|Run Girls, Run!|Simon & Garfunkel|THE RAMPAGE from EXILE TRIBE|Tackey & Tsubasa|Takako & The Crazy Boys|Voices From Mars|Wake Up, [^\\s]+!|Yamagami Lucy \\(…\\)|devils and realist|*\\(Asterisk\\)|[^\\s=,()]+)"#
_attributes = {'ARTIST_COMPONENT': "(\\(K\\)NoW_NAME|AKIMA & NEOS|ANNA TSUCHIYA inspi\\' NANA\\(BLACK STONES\\)|Bird Bear Hare and Fish|Bread & Butter|Carole\\s&\\sTuesday|Daisy x Daisy|Dejo & Bon|Digz, Inc. Group|Dimitri From Paris|Eunsol\\(1008\\)|Fear,\\sand\\sLoathing\\sin\\sLas\\sVegas|GENERATIONS from EXILE TRIBE|HIGH and MIGHTY COLOR|Hello, Happy World!|Hifumi,inc\\.|Kamisama, Boku wa Kizuite shimatta|Kevin & Cherry|King & Queen|Kisida Kyodan & The Akebosi Rockets|Konya, Anomachikara|Louis Armstrong and His Orchestra|MYTH\\s&\\sROID|OLIVIA inspi\\' REIRA\\(TRAPNEST\\)|Oranges\\s(and|&)\\sLemons|Rough & Ready|Run Girls, Run!|Simon & Garfunkel|THE RAMPAGE from EXILE TRIBE|Tackey & Tsubasa|Takako & The Crazy Boys|Voices From Mars|Wake Up, [^\\s]+!|Yamagami Lucy \\(…\\)|devils and realist|*\\(Asterisk\\)|[^\\s=,()]+)", 'COMMA': ',(\\sand)?\\s+', 'CV': '(CV[.:]|[Vv]ocals?:|[Mm]ain\\svocals?:|[Cc]omposed\\sby|[Ff]rom|[Ff]eat(\\.|uring)?|[Pp]erformed\\sby|Vo\\.)\\s+|=', 'LPAREN': '(?<=\\s)\\(', 'RPAREN': '\\)(?=\\s|,|\\)|$)', 'SPACE': '\\s+', 'SPECIAL_CASE': '^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$', 'VIA': "\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+", '__module__': 'nkdsu.apps.vote.parsers', '__qualname__': 'ArtistLexer', 'tokens': {'ARTIST_COMPONENT', 'COMMA', 'CV', 'LPAREN', 'RPAREN', 'SPACE', 'SPECIAL_CASE', 'VIA'}}#
_before = {}#
_delete = ['_', 'before']#
_ignored_tokens = {}#
_master_re = re.compile("(?P<SPECIAL_CASE>^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$)|(?P<VIA>\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+)|(?)#
_remap = {}#
_remapping = {}#
_rules = [('SPECIAL_CASE', '^(FLOWxGRANRODEO|SawanoHiroyuki\\[nZk\\]:.*)$'), ('VIA', "\\s+(from|ft\\.|feat(\\.|uring)?\\.?|[Ss]tarring|and|with|meets|adding|hugs|inspi\\'|a\\.k\\.a|x|×|n\\'|vs\\.?|/|\\+|&)\\s+"), ('LPAREN', '(?<=\\s)\\('), ('RPAREN', '\\)(?=\\s|,|\\)|$)'), ('CV', '(CV[.:]|[Vv]ocals?:|[Mm]ain\\svocals?:|[Cc]omposed\\sby|[Ff]rom|[Ff]eat(\\.|uring)?|[Pp]erformed\\sby|Vo\\.)\\s+|='), ('COMMA', ',(\\sand)?\\s+'), ('SPACE', '\\s+'), ('ARTIST_COMPONENT', "(\\(K\\)NoW_NAME|AKIMA & NEOS|ANNA TSUCHIYA inspi\\' NANA\\(BLACK STONES\\)|Bird Bear Hare and Fish|Bread & Butter|Carole\\s&\\sTuesday|Daisy x Daisy|Dejo & Bon|Digz, Inc. Group|Dimitri From Paris|Eunsol\\(1008\\)|Fear,\\sand\\sLoathing\\sin\\sLas\\sVegas|GENERATIONS from EXILE TRIBE|HIGH and MIGHTY COLOR|Hello, Happy World!|Hifumi,inc\\.|Kamisama, Boku wa Kizuite shimatta|Kevin & Cherry|King & Queen|Kisida Kyodan & The Akebosi Rockets|Konya, Anomachikara|Louis Armstrong and His Orchestra|MYTH\\s&\\sROID|OLIVIA inspi\\' REIRA\\(TRAPNEST\\)|Oranges\\s(and|&)\\sLemons|Rough & Ready|Run Girls, Run!|Simon & Garfunkel|THE RAMPAGE from EXILE TRIBE|Tackey & Tsubasa|Takako & The Crazy Boys|Voices From Mars|Wake Up, [^\\s]+!|Yamagami Lucy \\(…\\)|devils and realist|*\\(Asterisk\\)|[^\\s=,()]+)")]#
_token_funcs = {}#
_token_names = {'ARTIST_COMPONENT', 'COMMA', 'CV', 'LPAREN', 'RPAREN', 'SPACE', 'SPECIAL_CASE', 'VIA'}#
nkdsu.apps.vote.parsers.handle_special_case(token) Iterable[ArtistChunk][source]#
nkdsu.apps.vote.parsers.check_for_group(full_string: str, maybe_group_name: str) bool[source]#
nkdsu.apps.vote.parsers.chunk_artist(string: str, fail_silently: bool = True) Iterable[ArtistChunk][source]#

Return a bunch of ArtistChunks which, when combined, reform the string handed in.

nkdsu.apps.vote.parsers.parse_artist(string: str, fail_silently: bool = True) ParsedArtist[source]#

nkdsu.apps.vote.placeholder_avatars module#

nkdsu.apps.vote.placeholder_avatars.placeholder_avatar_for(voter: Voter) str[source]#

nkdsu.apps.vote.signals module#

nkdsu.apps.vote.signals.create_profile_on_user_creation(sender: type[Model], instance: Model, created: bool, raw: bool, using: str | None, update_fields: Sequence[str] | None, **kwargs) None[source]#
nkdsu.apps.vote.signals.make_elfs(**kwargs) None[source]#

nkdsu.apps.vote.trivia module#

nkdsu.apps.vote.twitter_auth module#

exception nkdsu.apps.vote.twitter_auth.DoNotAuthThroughTwitterPlease(msg: str)[source]#

Bases: BaseException

msg: str#
class nkdsu.apps.vote.twitter_auth.UserDetailsDict[source]#

Bases: TypedDict

username: str#
fullname: str#
default_profile_image: bool#
profile_image_url_https: str#
class nkdsu.apps.vote.twitter_auth.NkdsuTwitterAuth(*args, **kwargs)[source]#

Bases: TwitterOAuth

auth_url() str[source]#
auth_allowed(response: dict, details: UserDetailsDict) bool[source]#
get_user_details(response: dict) UserDetailsDict[source]#

Like super().get_user_details(), but doesn’t try to split names into first and last parts.

class nkdsu.apps.vote.twitter_auth.NkdsuStrategy(storage, request=None, tpl=None)[source]#

Bases: DjangoStrategy

Django social auth respects the “PIPELINE” Django setting, which we’re already using for django-pipeline, so we need to override that behaviour to ignore it.

get_pipeline(backend=None)[source]#
nkdsu.apps.vote.twitter_auth.adopt_twitter_metadata(request: HttpRequest, user: User, details: UserDetailsDict, *args, **kwargs) None[source]#

nkdsu.apps.vote.update_library module#

nkdsu.apps.vote.update_library.check_closeness_against_list(name, canonical_names: Iterable[str], reverse: bool = False) str | None[source]#
class nkdsu.apps.vote.update_library.MetadataWarning[source]#

Bases: TypedDict

A warning about a potential problem with a proposed metadata update.

field: Literal['added', 'album', 'anime', 'artist', 'composer', 'msec', 'role', 'title', 'year']#
message: str#
class nkdsu.apps.vote.update_library.FieldAlteration[source]#

Bases: TypedDict

field: str#
was: str#
becomes: str#
class nkdsu.apps.vote.update_library.MetadataChange[source]#

Bases: TypedDict

type: Literal['locked', 'change', 'new', 'hide']#
item: str#
changes: list[FieldAlteration]#
warnings: list[MetadataWarning]#
nkdsu.apps.vote.update_library.check_artist_consistency(track_artists: Iterable[str], all_artists: Iterable[str], field: Literal['added', 'album', 'anime', 'artist', 'composer', 'msec', 'role', 'title', 'year']) list[MetadataWarning][source]#
nkdsu.apps.vote.update_library.metadata_consistency_checks(db_track: Track, all_anime_titles: Iterable[str], all_artists: Iterable[str], all_composers: Iterable[str]) list[MetadataWarning][source]#

Take a proposed update to the library, and check it for various types of things that might be wrong with it.

nkdsu.apps.vote.update_library.update_library(tree, dry_run: bool = False, inudesu: bool = False) list[MetadataChange][source]#

nkdsu.apps.vote.urls module#

nkdsu.apps.vote.utils module#

class nkdsu.apps.vote.utils.BrowsableItem(url: 'Optional[str]', name: 'str', visible: 'bool' = True)[source]#

Bases: object

url: str | None#
name: str#
visible: bool = True#
group() tuple[int, str][source]#

Return a sort order and a user-facing name for the group to put this item in. By default, an initial letter.

class nkdsu.apps.vote.utils.BrowsableYear(url: 'Optional[str]', name: 'str', visible: 'bool' = True)[source]#

Bases: BrowsableItem

group() tuple[int, str][source]#
nkdsu.apps.vote.utils.length_str(msec: float) str[source]#

Convert a number of milliseconds into a human-readable representation of the length of a track.

>>> length_str(999)
'0:00'
>>> length_str(1000)
'0:01'
>>> length_str(1000 * (60 + 15))
'1:15'
>>> length_str(1000 * (60 + 15))
'1:15'
>>> length_str((60 * 60 * 1000) + (1000 * (60 + 15)))
'1:01:15'
nkdsu.apps.vote.utils.camel_to_snake(camel: str) str[source]#
>>> camel_to_snake('camelCaseABCD')
'camel_case_a_b_c_d'
nkdsu.apps.vote.utils.track_with_get_param_url(tracks: Iterable[Track], url: str) str[source]#

Generate a URL for a view that uses TracksFromGetParamMixin.

nkdsu.apps.vote.utils.add_to_list_url(tracks: Iterable[Track]) str[source]#
nkdsu.apps.vote.utils.vote_url(tracks: Iterable[Track]) str[source]#
nkdsu.apps.vote.utils.split_id3_title(id3_title: str) tuple[str, str | None][source]#

Take a ‘Title (role)’-style ID3 title and return (title, role).

>>> split_id3_title('title')
('title', None)
>>> split_id3_title('title (role)')
('title', 'role')

The role will be populated if we’re able to find a set of matching brackets starting with the final character:

>>> split_id3_title('title ((role)')
('title (', 'role')
>>> split_id3_title('title ((r(o)(l)e)')
('title (', 'r(o)(l)e')

But no role will be returned if the brackets close more than they open, or if the final character is not a ):

>>> split_id3_title('title (role) ')
('title (role) ', None)
>>> split_id3_title('title (role))')
('title (role))', None)
nkdsu.apps.vote.utils.split_query_into_keywords(query: str) list[str][source]#

Split the query into keywords. Where keywords are double quoted together, use as one keyword.

>>> split_query_into_keywords('hello there, how are you doing')
['hello', 'there,', 'how', 'are', 'you', 'doing']
>>> split_query_into_keywords('hello there, "how are you doing"')
['how are you doing', 'hello', 'there,']
nkdsu.apps.vote.utils.memoize(func: C) C[source]#

Do nothing, for now; lru_cache() does not get wiped for new instances of self, which is a problem when we need to catch updates.

nkdsu.apps.vote.utils.cached(seconds: int, cache_key: str) Callable[[C], C][source]#
nkdsu.apps.vote.utils.pk_cached(seconds: int) Callable[[T], T][source]#
nkdsu.apps.vote.utils.lastfm(**kwargs)[source]#
nkdsu.apps.vote.utils.assert_never(value: NoReturn) NoReturn[source]#
nkdsu.apps.vote.utils.get_profile_for(user: User) Profile[source]#
nkdsu.apps.vote.utils.vote_edit_cutoff() Show[source]#

Return the last show for which vote comments should be editable.

nkdsu.apps.vote.voter module#

class nkdsu.apps.vote.voter.ModelVoterMeta(name, bases, namespace, /, **kwargs)[source]#

Bases: _ProtocolMeta, ModelBase

class nkdsu.apps.vote.voter.Voter(*args, **kwargs)[source]#

Bases: Protocol

name: str | CharField#
pk: int#
is_abuser: bool | BooleanField#
is_patron: bool | BooleanField#
_twitter_user_and_profile() tuple[TwitterUser | None, Profile | None][source]#
property username: str#
property voter_id: tuple[int | None, int | None]#

A unique identifier that will be the same for TwitterUser and Profile instances that represent the same accounts.

property badges: QuerySet[UserBadge]#
unordered_votes() QuerySet[Vote][source]#
get_toggle_abuser_url() str[source]#
votes() QuerySet[Vote][source]#
votes_with_liberal_preselection() QuerySet[Vote][source]#
votes_for(show: Show) QuerySet[Vote][source]#
tracks_voted_for_for(show: Show) list[Track][source]#
is_new() bool[source]#
is_placated() bool[source]#
is_shortlisted() bool[source]#
has_max_websites() bool[source]#
get_websites() Iterable[UserWebsite][source]#
_batting_average(cutoff: datetime | None = None, minimum_weight: float = 1) float | None[source]#
batting_average(minimum_weight: float = 1) float | None[source]#

Return a user’s batting average for the past six months.

_streak(ls=[]) int[source]#
streak() int[source]#
all_time_batting_average(minimum_weight: float = 1) float | None[source]#
_abc_impl = <_abc._abc_data object>#
_is_protocol = True#