Skip to content

Commit

Permalink
Update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TLNBS2405 committed Jan 14, 2024
1 parent 7a3ded9 commit 2c0aaf1
Show file tree
Hide file tree
Showing 9 changed files with 1,482 additions and 1,476 deletions.
424 changes: 212 additions & 212 deletions src/json_movelist/asuka.json

Large diffs are not rendered by default.

332 changes: 166 additions & 166 deletions src/json_movelist/azucena.json

Large diffs are not rendered by default.

490 changes: 245 additions & 245 deletions src/json_movelist/bryan.json

Large diffs are not rendered by default.

236 changes: 118 additions & 118 deletions src/json_movelist/claudio.json

Large diffs are not rendered by default.

412 changes: 206 additions & 206 deletions src/json_movelist/jun.json

Large diffs are not rendered by default.

330 changes: 165 additions & 165 deletions src/json_movelist/kazuya.json

Large diffs are not rendered by default.

436 changes: 218 additions & 218 deletions src/json_movelist/raven.json

Large diffs are not rendered by default.

254 changes: 127 additions & 127 deletions src/json_movelist/yoshimitsu.json

Large diffs are not rendered by default.

44 changes: 25 additions & 19 deletions src/wavu/wavu_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ def _get_all_parent_values_of(field: str, move_id: str, move_list_json: list) ->
if "_" in original_move:
original_move = original_move.split("_")[0]
complete_input += _get_all_parent_values_of(field, original_move, move_list_json)
return complete_input + move["title"][field]
return complete_input + _normalize_data(move["title"][field])
else:
return ""


def _remove_non_ascii(data):
return re.sub(r'[^\x00-\x7F]+', '', data)
def _normalize_data(data):
if data:
# remove non-ascii stuff
return re.sub(r'[^\x00-\x7F]+', '', data)
else:
return ""


# last entry is always the input
Expand All @@ -88,30 +92,32 @@ def _create_alias(input: str) -> List[str]:
def _convert_json_movelist(move_list_json: list) -> List[Move]:
move_list = []
for move in move_list_json:
if move["title"]["ns"]=="0":
if move["title"]["ns"] == "0":
alias = []
id = _remove_non_ascii(move["title"]["id"])
name = _remove_non_ascii(move["title"]["name"])
id = _normalize_data(move["title"]["id"])
name = _normalize_data(move["title"]["name"])

input = _remove_non_ascii(
input = _normalize_data(
_get_all_parent_values_of("input", move["title"]["parent"], move_list_json) + move["title"]["input"])
if "_" in input:
result = _create_alias(input)
input = result[-1]
alias = result[0:(len(result) - 1)]

target = _remove_non_ascii(
_get_all_parent_values_of("target", move["title"]["parent"], move_list_json) + move["title"]["target"])
damage = _remove_non_ascii(
_get_all_parent_values_of("damage", move["title"]["parent"], move_list_json) + move["title"]["damage"])
target = _normalize_data(
_get_all_parent_values_of("target", _normalize_data(move["title"]["parent"]),
move_list_json) + _normalize_data(move["title"]["target"]))
damage = _normalize_data(
_get_all_parent_values_of("damage", _normalize_data(move["title"]["parent"]),
move_list_json) + _normalize_data(move["title"]["damage"]))

on_block = _remove_non_ascii(move["title"]["block"])
on_hit = _remove_non_ascii(_normalize_hit_ch_input(move["title"]["hit"]))
on_ch = _remove_non_ascii(_normalize_hit_ch_input(move["title"]["ch"]))
startup = _remove_non_ascii(move["title"]["startup"])
recovery = _remove_non_ascii(move["title"]["recv"])
on_block = _normalize_data(move["title"]["block"])
on_hit = _normalize_data(_normalize_hit_ch_input(move["title"]["hit"]))
on_ch = _normalize_data(_normalize_hit_ch_input(move["title"]["ch"]))
startup = _normalize_data(move["title"]["startup"])
recovery = _normalize_data(move["title"]["recv"])

notes = html.unescape(move["title"]["notes"])
notes = html.unescape(_normalize_data(move["title"]["notes"]))
notes = BeautifulSoup(notes, features="lxml").get_text()
notes = notes.replace("* \n", "* ")

Expand All @@ -121,11 +127,11 @@ def _convert_json_movelist(move_list_json: list) -> List[Move]:


def _normalize_hit_ch_input(entry: str) -> str:
if "|" in entry:
if entry and "|" in entry:
pattern = r'\|([^|]+)\]\]'
match = re.search(pattern, entry)
if match:
return match.group(1)
return entry
else:
return entry
return ""

0 comments on commit 2c0aaf1

Please sign in to comment.