Skip to content

Commit f165366

Browse files
committed
implemented #81
1 parent dda2ff9 commit f165366

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

xbrl/instance.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,13 @@ def parse_ixbrl_url(instance_url: str, cache: HttpCache) -> XbrlInstance:
366366
return parse_ixbrl(instance_path, cache, instance_url)
367367

368368

369-
def parse_ixbrl(instance_path: str, cache: HttpCache, instance_url: str or None = None) -> XbrlInstance:
369+
def parse_ixbrl(instance_path: str, cache: HttpCache, instance_url: str or None = None, encoding=None) -> XbrlInstance:
370370
"""
371371
Parses a inline XBRL (iXBRL) instance file.
372372
:param instance_path: path to the submission you want to parse
373373
:param cache: HttpCache instance
374374
:param instance_url: url to the instance file(on the internet)
375+
:param encoding: optionally specify a file encoding
375376
This function will check, if the instance file is already in the cache and load it from there based on the
376377
instance_url.
377378
For EDGAR submissions: Before calling this method; extract the enclosure and copy the files to the cache.
@@ -384,7 +385,7 @@ def parse_ixbrl(instance_path: str, cache: HttpCache, instance_url: str or None
384385
=> in the XBRL-parse function root is ET.Element, here just an instance of ElementTree class!
385386
"""
386387

387-
instance_file = open(instance_path, "r")
388+
instance_file = open(instance_path, "r", encoding=encoding)
388389
contents = instance_file.read()
389390
pattern = r'<[ ]*script.*?\/[ ]*script[ ]*>'
390391
contents = re.sub(pattern, '', contents, flags=(re.IGNORECASE | re.MULTILINE | re.DOTALL))

xbrl/transformations/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def entityFilerCategoryEN(arg: str) -> str:
362362
return 'Accelerated Filer'
363363
elif arg == 'non-accelerated filer':
364364
return 'Non-accelerated Filer'
365-
raise TransformationException(f'Unknown filer category')
365+
raise TransformationException(f'Unknown filer category "{arg}"')
366366

367367

368368
# endregion ixt-sec mappings

0 commit comments

Comments
 (0)