Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add types #507

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions kn/base/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.conf import settings
from datetime import datetime

DT_MIN = settings.DT_MIN
DT_MAX = settings.DT_MAX
DT_MIN: datetime = settings.DT_MIN
DT_MAX: datetime = settings.DT_MAX

# vim: et:sta:bs=2:sw=4:
2 changes: 2 additions & 0 deletions kn/fotos/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import random
import re
import subprocess
import typing
from collections import namedtuple

import PIL.Image
Expand Down Expand Up @@ -102,6 +103,7 @@ def actual_visibility(visibility):


class FotoEntity(SONWrapper):
CACHES:typing.Dict[str, cache_tuple]
CACHES = {}

def __init__(self, data):
Expand Down
2 changes: 1 addition & 1 deletion kn/leden/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def delete_note(data, request):
( << {ok: false, error: "Note not found"} ) """
if 'secretariaat' not in request.user.cached_groups_names:
return {'ok': False, 'error': 'Permission denied'}
note = Es.note_by_id(_id(data.get('id')))
note = Es.Note.by_id(_id(data.get('id')))
if note is None:
return {'ok': False, 'error': 'Note not found'}
note.delete()
Expand Down
6 changes: 3 additions & 3 deletions kn/leden/date.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import datetime


def now():
def now() -> datetime.datetime:
return datetime.datetime.now()


def date_to_dt(d):
def date_to_dt(d: datetime.date) -> datetime.datetime:
return datetime.datetime.combine(d, datetime.time())


def date_to_midnight(d):
def date_to_midnight(d: datetime.date) -> datetime.datetime:
return datetime.datetime(d.year, d.month, d.day)

# vim: et:sta:bs=2:sw=4:
Loading