-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
148 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .http import inertia, render, location | ||
from .utils import lazy, optional, defer | ||
from .utils import lazy, optional, defer, merge | ||
from .share import share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from abc import ABC, abstractmethod | ||
import warnings | ||
|
||
class CallableProp(ABC): | ||
def __init__(self, prop): | ||
self.prop = prop | ||
|
||
def __call__(self): | ||
return self.prop() if callable(self.prop) else self.prop | ||
|
||
class MergeableProp(ABC): | ||
@abstractmethod | ||
def should_merge(self): | ||
pass | ||
|
||
class IgnoreOnFirstLoadProp(ABC): | ||
pass | ||
|
||
class OptionalProp(CallableProp, IgnoreOnFirstLoadProp): | ||
pass | ||
|
||
class DeferredProp(CallableProp, MergeableProp, IgnoreOnFirstLoadProp): | ||
def __init__(self, prop, group, merge=False): | ||
super().__init__(prop) | ||
self.group = group | ||
self.merge = merge | ||
|
||
def should_merge(self): | ||
return self.merge | ||
|
||
class MergeProp(CallableProp, MergeableProp): | ||
def should_merge(self): | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters