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 os
import re import re
import json import json
from src.article import LexiconArticle from article import LexiconArticle
from src import build import build
from src import utils import utils
def is_lexicon(name): def is_lexicon(name):
""" """

View File

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

View File

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

View File

View File

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