def load() -> all_items.AllItems: """Load the osrsbox item database. :return all_db_items: An AllItems object containing the entire item database. """ return all_items.AllItems()
def test_all_items_load_items_complete(path_to_docs_dir: Path): path_to_items_complete = path_to_docs_dir / "items-complete.json" all_db_items = all_items.AllItems(str(path_to_items_complete)) assert len(all_db_items.all_items) == NUMBER_OF_ITEMS
(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ############################################################################### """ from osrsbox.items_api import all_items if __name__ == "__main__": import argparse ap = argparse.ArgumentParser() ap.add_argument( "-i", "--input", required=True, help= "Either 1) Folder of JSON item (items-json), 2) Single JSON file (items-complete.json)" ) args = vars(ap.parse_args()) # Initialize the AllItems class using the user-supplied osrsbox-db location ai = all_items.AllItems(args["input"]) # Loop through all items in the database and print the item name for each item for item in ai: print(item.name)