From a6926104f3d4de1083c7e77d572291625c3619a1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 12 Mar 2021 22:19:09 +0100 Subject: Adding upstream version 2.1.2. Signed-off-by: Daniel Baumann --- identify/extensions.py | 1 + identify/identify.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'identify') diff --git a/identify/extensions.py b/identify/extensions.py index 778b695..48864fc 100644 --- a/identify/extensions.py +++ b/identify/extensions.py @@ -183,6 +183,7 @@ EXTENSIONS = { 'txsprofile': {'text', 'ini', 'txsprofile'}, 'txt': {'text', 'plain-text'}, 'v': {'text', 'verilog'}, + 'vb': {'text', 'vb'}, 'vbproj': {'text', 'xml', 'vbproj'}, 'vcxproj': {'text', 'xml', 'vcxproj'}, 'vdx': {'text', 'vdx'}, diff --git a/identify/identify.py b/identify/identify.py index 51c1288..52d2c2d 100644 --- a/identify/identify.py +++ b/identify/identify.py @@ -1,3 +1,4 @@ +import errno import os.path import re import shlex @@ -205,8 +206,14 @@ def parse_shebang_from_file(path: str) -> Tuple[str, ...]: if not os.access(path, os.X_OK): return () - with open(path, 'rb') as f: - return parse_shebang(f) + try: + with open(path, 'rb') as f: + return parse_shebang(f) + except OSError as e: + if e.errno == errno.EINVAL: + return () + else: + raise COPYRIGHT_RE = re.compile(r'^\s*(Copyright|\(C\)) .*$', re.I | re.MULTILINE) -- cgit v1.2.3