Skip to content

Commit

Permalink
ignore warnings from csvw about unspecified columns - the spec allows…
Browse files Browse the repository at this point in the history
… arbitrary additional columns
  • Loading branch information
xrotwang committed Oct 11, 2019
1 parent 369e36d commit 263fdb2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/segments/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections import Counter, OrderedDict
import unicodedata
from pathlib import Path
import warnings

from csvw import TableGroup, Column
from clldutils.path import readlines
Expand Down Expand Up @@ -109,10 +110,13 @@ def from_file(cls, fname, form=None):
raise ValueError('profile description must contain exactly one table')
metadata = tg.common_props
metadata.update(fname=Path(fname), form=form)
return cls(
*[{k: None if (k != cls.GRAPHEME_COL and v == cls.NULL) else v for k, v in d.items()}
for d in tg.tables[0].iterdicts(fname=opfname)],
**metadata)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
res = cls(
*[{k: None if (k != cls.GRAPHEME_COL and v == cls.NULL) else v for k, v in d.items()}
for d in tg.tables[0].iterdicts(fname=opfname)],
**metadata)
return res

@classmethod
def from_text(cls, text, mapping='mapping'):
Expand Down

0 comments on commit 263fdb2

Please sign in to comment.