Skip to content

Commit

Permalink
chore: replace deprecated pkg_resources.resource_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Sep 15, 2023
1 parent 59f6087 commit ab58d6b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions augur/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import os, json, sys
import pandas as pd
from collections import defaultdict, OrderedDict
from pkg_resources import resource_stream
from io import TextIOWrapper
from importlib.resources import open_text
from .__version__ import __version__

from augur.io.file import open_file
Expand Down Expand Up @@ -243,10 +242,9 @@ def add_line_to_coordinates(line):
else:
print("WARNING: geo-coordinate file contains invalid line. Please make sure not to mix tabs and spaces as delimiters (use only tabs):",line)
if use_defaults:
with resource_stream(__package__, "data/lat_longs.tsv") as stream:
with TextIOWrapper(stream, "utf-8") as defaults:
for line in defaults:
add_line_to_coordinates(line)
with open_text(__package__, "data/lat_longs.tsv") as defaults:
for line in defaults:
add_line_to_coordinates(line)
if overrides:
if os.path.isfile(overrides):
with open(overrides, encoding='utf-8') as ifile:
Expand Down

0 comments on commit ab58d6b

Please sign in to comment.