Adjust paths for package org

This commit is contained in:
Tim Van Baak 2019-04-22 14:14:59 -07:00
parent 2243cae653
commit 95d2cddf17
5 changed files with 10 additions and 8 deletions

View File

@ -8,9 +8,9 @@ import argparse
import os
import re
import json
from src.article import LexiconArticle
from src import build
from src import utils
from article import LexiconArticle
import build
import utils
def is_lexicon(name):
"""

View File

@ -1,7 +1,7 @@
import os
import sys
import re
import src.utils as utils
import utils
class LexiconCitation:
"""

View File

@ -5,8 +5,8 @@ import io # For writing pages out as UTF-8
import networkx # For pagerank analytics
from collections import defaultdict # For rank inversion in statistics
from src import utils
from src.article import LexiconArticle
import utils
from article import LexiconArticle
class LexiconPage:
"""

View File

View File

@ -1,6 +1,7 @@
import os
import re
from urllib import parse
import pkg_resources
# Short utility functions for handling titles
@ -37,8 +38,9 @@ def titlesort(s):
def load_resource(filename, cache={}):
"""Loads files from the resources directory with caching."""
if filename not in cache:
with open(os.path.join("src", "resources", filename), "r", encoding="utf-8") as f:
cache[filename] = f.read()
binary = pkg_resources.resource_string("resources", filename)
unistr = binary.decode("utf-8")
cache[filename] = unistr
return cache[filename]
def load_config(name):