Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.
Merged
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
6 changes: 3 additions & 3 deletions outer_join/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
BaseTable as _BaseTable,
Join as _Join,
)
from selfhacked.util.func import (

from .util import (
cached_property,
returns as _returns,
)

from .util import cached_property
from .util.info import (
ModelInfo as _ModelInfo,
FieldInfo as _FieldInfo,
Expand Down
27 changes: 26 additions & 1 deletion outer_join/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
import typing as _typing
from django.utils.functional import (
cached_property as _cached_property,
)
from functools import (
wraps as _wraps,
)

cached_property = _cached_property
from .typing import (
T as _T,
)

# PyCharm doesn't like aliases for cached_property, so we unify import from here
# Avoid cleanup import by PyCharm
cached_property = _cached_property


class returns(object):
"""
This code can be found in selfhacked-util
However it's the only thing we need from the package,
so we are copying the code here and getting rid of the dependency.
"""

def __init__(self, type: _typing.Type[_T]):
self.__type = type

def __call__(self, func) -> _T:
@_wraps(func)
def __new_func(*args, **kwargs):
return self.__type(func(*args, **kwargs))

return __new_func
6 changes: 3 additions & 3 deletions outer_join/util/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from django.forms import (
model_to_dict as _model_to_dict,
)
from selfhacked.util.func import (

from . import (
cached_property,
returns as _returns,
)

from . import cached_property
from .datatypes import (
ImmutableDict as _ImmutableDict,
)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

install_requires=[
'Django>=1.11',
'selfhacked-util @ https://github.com/SelfHacked/selfhacked-util/archive/master.zip',
],

extras_require={
Expand Down