mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 07:30:37 +01:00
update test
Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
parent
0536aba4f4
commit
bbbec5569f
2 changed files with 9 additions and 9 deletions
|
|
@ -219,14 +219,15 @@ components:
|
||||||
additionalProperties: true # todo
|
additionalProperties: true # todo
|
||||||
|
|
||||||
ClientEventInfo:
|
ClientEventInfo:
|
||||||
required:
|
|
||||||
- component
|
|
||||||
- elemen
|
|
||||||
properties:
|
properties:
|
||||||
component:
|
component:
|
||||||
type: string # enum half_cover
|
# enum half_cover
|
||||||
|
type: string
|
||||||
element:
|
element:
|
||||||
type: string
|
type: string
|
||||||
# august-2023-privacy-prompt-candidate
|
# august-2023-privacy-prompt-candidate
|
||||||
pattern: "(([a-z]+|[0-9]+|[0-9a-f]+)(-|$))+"
|
# pattern: "(([a-z]+|[0-9]+|[0-9a-f]+)(-|$))+"
|
||||||
# pattern: "^(january|february|march|april|may|june|july|august|september|october|november|december)-[0-9]{4}-([a-z]-)+[a-z]+$"
|
# pattern: "^(january|february|march|april|may|june|july|august|september|october|november|december)-[0-9]{4}-([a-z]-)+[a-z]+$"
|
||||||
|
details:
|
||||||
|
type: object
|
||||||
|
additionalProperties: true # todo
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,10 @@ def task_callback(file, thread=True):
|
||||||
cache = json.load(f)
|
cache = json.load(f)
|
||||||
data = pt.__dict__[cache["type"]].from_json(cache["raw"])
|
data = pt.__dict__[cache["type"]].from_json(cache["raw"])
|
||||||
rate = match_rate(data.to_dict(), json.loads(cache["raw"]))
|
rate = match_rate(data.to_dict(), json.loads(cache["raw"]))
|
||||||
return {rate}, {file}
|
return rate, file
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if thread:
|
if thread:
|
||||||
return 0, {file}
|
return 0, file
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
@ -153,8 +153,7 @@ if __name__ == "__main__":
|
||||||
with concurrent.futures.ProcessPoolExecutor() as executor:
|
with concurrent.futures.ProcessPoolExecutor() as executor:
|
||||||
tasks = [executor.submit(task_callback, x) for x in glob.glob("cache/*.json")]
|
tasks = [executor.submit(task_callback, x) for x in glob.glob("cache/*.json")]
|
||||||
for task in concurrent.futures.as_completed(tasks):
|
for task in concurrent.futures.as_completed(tasks):
|
||||||
rate, file = [list(x).pop() for x in task.result()]
|
rate, file = task.result()
|
||||||
print(rate, file)
|
|
||||||
if rate < 1:
|
if rate < 1:
|
||||||
fail.append(file)
|
fail.append(file)
|
||||||
logger.info(f"Match rate: {rate}")
|
logger.info(f"Match rate: {rate}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue