Skip to content

Commit

Permalink
feat: limit valid check framework
Browse files Browse the repository at this point in the history
WIP

Close #6
  • Loading branch information
LaoshuBaby committed Apr 17, 2023
1 parent 4980bf6 commit c18bebb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kqs/model_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ def __init__(self, attrib: Dict[str, str], tag_dict: Dict[str, str]):
def flush(self):
# 移除自身,但如果有被编辑应给予警告,在force的情况下可以强制从数据库中移除,即调用析构函数
pass

def is_limit_valid(self):
# conduct check API_LIMIT_MAX_KEY_LENGTH while modify tags
return True
16 changes: 16 additions & 0 deletions src/kqs/type_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from .model_basic import Base, BaseOsmModel
from .type_constraint import Member

# TODO
# limit check should be conduct while modify


class Node(BaseOsmModel):
upstream_way: list = [0]
Expand Down Expand Up @@ -66,6 +69,10 @@ def find_history(self):
# return list(Node())
pass

def is_limit_valid(self):
# if len<API_LIMIT_MAX_ELEMENT_TAGS:
return True


class Way(BaseOsmModel):
upstream_relation: list = [0]
Expand Down Expand Up @@ -104,6 +111,11 @@ def get_upstream_relation(self, order=-1):
return self.upstream_relation
else:
return self.upstream_relation[order]

def is_limit_valid(self):
# if len<API_LIMIT_MAX_ELEMENT_TAGS:
# if len>0 and len<API_LIMIT_MAX_WAY_NODES:
return True


class Relation(BaseOsmModel):
Expand Down Expand Up @@ -148,3 +160,7 @@ def get_upstream_relation(self, order=-1):
return self.upstream_relation
else:
return self.upstream_relation[order]

def is_limit_valid(self):
# if len<API_LIMIT_MAX_RELATION_MEMBERS
return True
6 changes: 6 additions & 0 deletions src/kqs/waifu.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ def read_network_element_batch(
pass

def write(self, mode=None, file_path=""):
def is_limit_valid(ignore=False):
# conduct limit check
# for ele in nwr
# if ele.is_limit_valid=True
return True

if mode == "file":
self.write_file(file_path)
elif mode == "network":
Expand Down

0 comments on commit c18bebb

Please sign in to comment.