Skip to content

Commit

Permalink
Make scripts run without install (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
tushuhei authored Aug 15, 2023
1 parent ce2eda8 commit f80bfb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion scripts/encode_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
import functools
import itertools
import multiprocessing
import os
import sys
import typing

from budoux import utils
# module hack
LIB_PATH = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, os.path.abspath(LIB_PATH))

from budoux import utils # noqa (module hack)

ArgList = typing.Optional[typing.List[str]]
DEFAULT_OUTPUT_FILENAME = 'encoded_data.txt'
Expand Down
7 changes: 6 additions & 1 deletion scripts/prepare_knbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@

import argparse
import os
import sys
import typing
from html.parser import HTMLParser

from budoux import utils
# module hack
LIB_PATH = os.path.join(os.path.dirname(__file__), '..')
sys.path.insert(0, os.path.abspath(LIB_PATH))

from budoux import utils # noqa (module hack)


class KNBCHTMLParser(HTMLParser):
Expand Down
3 changes: 1 addition & 2 deletions scripts/tests/test_encode_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
import typing
import unittest

from budoux import utils

# module hack
LIB_PATH = os.path.join(os.path.dirname(__file__), '..', '..')
sys.path.insert(0, os.path.abspath(LIB_PATH))

from budoux import utils # noqa (module hack)
from scripts import encode_data # noqa (module hack)


Expand Down

0 comments on commit f80bfb6

Please sign in to comment.