Control: tags -1 patch

On 2020-05-04 15:43:48 +0200, Vincent Lefevre wrote:
> Since the switch to python3.8, running codespell triggers a warning:
> 
> /usr/lib/python3.8/codecs.py:905: RuntimeWarning: line buffering 
> (buffering=1) isn't supported in binary mode, the default buffer size will be 
> used
>   file = builtins.open(filename, mode, buffering)
> 
> The bug against codespell was reported upstream here:
> 
>   https://github.com/codespell-project/codespell/issues/1331
> 
> now closed, as being fixed:
> 
>   https://github.com/codespell-project/codespell/pull/1401

I've attached a patch corresponding to

  
https://github.com/codespell-project/codespell/commit/33647e28b708c5736bab4608b1d422f0433eb0a8#diff-c4984ff60bb6d58a3a2f9940d1a396f9

for codespell 1.16.0-2.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Index: codespell-1.16.0/codespell_lib/_codespell.py
===================================================================
--- codespell-1.16.0.orig/codespell_lib/_codespell.py
+++ codespell-1.16.0/codespell_lib/_codespell.py
@@ -309,13 +309,13 @@ def build_exclude_hashes(filename, exclu
 
 
 def build_ignore_words(filename, ignore_words):
-    with codecs.open(filename, mode='r', buffering=1, encoding='utf-8') as f:
+    with codecs.open(filename, mode='r', encoding='utf-8') as f:
         for line in f:
             ignore_words.add(line.strip())
 
 
 def build_dict(filename, misspellings, ignore_words):
-    with codecs.open(filename, mode='r', buffering=1, encoding='utf-8') as f:
+    with codecs.open(filename, mode='r', encoding='utf-8') as f:
         for line in f:
             [key, data] = line.split('->')
             # TODO for now, convert both to lower. Someday we can maybe add
@@ -345,11 +345,8 @@ def build_dict(filename, misspellings, i
 def is_hidden(filename, check_hidden):
     bfilename = os.path.basename(filename)
 
-    if bfilename != '' and bfilename != '.' and bfilename != '..' \
-                    and (not check_hidden and bfilename[0] == '.'):
-        return True
-
-    return False
+    return bfilename not in ('', '.', '..') and \
+        (not check_hidden and bfilename[0] == '.')
 
 
 def is_text_file(filename):

Reply via email to