1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
From: Christian Kastner <ckk@kvr.at>
Date: Mon, 30 Mar 2020 22:18:37 +0200
Subject: Drop bufsize argument to Popen
It's only allowed in text mode, and with Python 3.8, we get a ton of the
following warnings:
usr/lib/python3.8/subprocess.py:844: RuntimeWarning: line buffering
(buffering=1) isn't supported in binary mode, the default buffer size will be
used
self.stdout = io.open(c2pread, 'rb', bufsize)
---
gitinspector/basedir.py | 6 +++---
gitinspector/blame.py | 4 ++--
gitinspector/changes.py | 4 ++--
gitinspector/clone.py | 2 +-
gitinspector/config.py | 2 +-
gitinspector/filtering.py | 2 +-
gitinspector/metrics.py | 4 ++--
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/gitinspector/basedir.py b/gitinspector/basedir.py
index 39e0094..524fbdf 100644
--- a/gitinspector/basedir.py
+++ b/gitinspector/basedir.py
@@ -33,7 +33,7 @@ def get_basedir_git():
global __git_basedir__
if not __git_basedir__:
- sp = subprocess.Popen(["git", "rev-parse", "--is-bare-repository"], bufsize=1,
+ sp = subprocess.Popen(["git", "rev-parse", "--is-bare-repository"],
stdout=subprocess.PIPE, stderr=open(os.devnull, "w"))
isbare = sp.stdout.readlines()
sp.wait()
@@ -43,9 +43,9 @@ def get_basedir_git():
absolute_path = None
if isbare:
- absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], bufsize=1, stdout=subprocess.PIPE).stdout
+ absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], stdout=subprocess.PIPE).stdout
else:
- absolute_path = subprocess.Popen(["git", "rev-parse", "--show-toplevel"], bufsize=1,
+ absolute_path = subprocess.Popen(["git", "rev-parse", "--show-toplevel"],
stdout=subprocess.PIPE).stdout
absolute_path = absolute_path.readlines()
diff --git a/gitinspector/blame.py b/gitinspector/blame.py
index 3aadbf7..28e319d 100644
--- a/gitinspector/blame.py
+++ b/gitinspector/blame.py
@@ -101,7 +101,7 @@ class BlameThread(threading.Thread):
__blame_lock__.release() # ...to here.
def run(self):
- git_blame_r = subprocess.Popen(self.blame_command, bufsize=1, stdout=subprocess.PIPE).stdout
+ git_blame_r = subprocess.Popen(self.blame_command, stdout=subprocess.PIPE).stdout
rows = git_blame_r.readlines()
git_blame_r.close()
@@ -133,7 +133,7 @@ PROGRESS_TEXT = N_("Checking how many rows belong to each author (Progress): {0:
class Blame:
def __init__(self, hard, useweeks, changes):
self.blames = {}
- ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()], bufsize=1,
+ ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()],
stdout=subprocess.PIPE).stdout
lines = ls_tree_r.readlines()
ls_tree_r.close()
diff --git a/gitinspector/changes.py b/gitinspector/changes.py
index f765a05..c9c1adf 100644
--- a/gitinspector/changes.py
+++ b/gitinspector/changes.py
@@ -128,7 +128,7 @@ class ChangesThread(threading.Thread):
git_log_r = subprocess.Popen([_f for _f in ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE",
"--stat=100000,8192", "--no-merges", "-w", interval.get_since(),
interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
- [self.first_hash + self.second_hash] if _f], bufsize=1, stdout=subprocess.PIPE).stdout
+ [self.first_hash + self.second_hash] if _f], stdout=subprocess.PIPE).stdout
lines = git_log_r.readlines()
git_log_r.close()
@@ -186,7 +186,7 @@ class Changes:
def __init__(self, hard):
self.commits = []
git_log_hashes_r = subprocess.Popen([_f for _f in ["git", "rev-list", "--reverse", "--no-merges",
- interval.get_since(), interval.get_until(), "HEAD"] if _f], bufsize=1,
+ interval.get_since(), interval.get_until(), "HEAD"] if _f],
stdout=subprocess.PIPE).stdout
lines = git_log_hashes_r.readlines()
git_log_hashes_r.close()
diff --git a/gitinspector/clone.py b/gitinspector/clone.py
index 8d4897e..3d9be15 100644
--- a/gitinspector/clone.py
+++ b/gitinspector/clone.py
@@ -32,7 +32,7 @@ def create(url):
global __cloned_path__
location = tempfile.mkdtemp(suffix=".gitinspector")
- git_clone = subprocess.Popen(["git", "clone", url, location], bufsize=1, stdout=sys.stderr)
+ git_clone = subprocess.Popen(["git", "clone", url, location], stdout=sys.stderr)
git_clone.wait()
if git_clone.returncode != 0:
diff --git a/gitinspector/config.py b/gitinspector/config.py
index 8cf4c3c..4077ca4 100644
--- a/gitinspector/config.py
+++ b/gitinspector/config.py
@@ -29,7 +29,7 @@ import subprocess
def __read_git_config__(repo, variable):
previous_directory = os.getcwd()
os.chdir(repo)
- setting = subprocess.Popen(["git", "config", "inspector." + variable], bufsize=1, stdout=subprocess.PIPE).stdout
+ setting = subprocess.Popen(["git", "config", "inspector." + variable], stdout=subprocess.PIPE).stdout
os.chdir(previous_directory)
try:
diff --git a/gitinspector/filtering.py b/gitinspector/filtering.py
index e4c5f5a..3efedef 100644
--- a/gitinspector/filtering.py
+++ b/gitinspector/filtering.py
@@ -63,7 +63,7 @@ def has_filtered():
return False
def __find_commit_message__(sha):
- git_show_r = subprocess.Popen([_f for _f in ["git", "show", "-s", "--pretty=%B", "-w", sha] if _f], bufsize=1,
+ git_show_r = subprocess.Popen([_f for _f in ["git", "show", "-s", "--pretty=%B", "-w", sha] if _f],
stdout=subprocess.PIPE).stdout
commit_message = git_show_r.read()
diff --git a/gitinspector/metrics.py b/gitinspector/metrics.py
index 0c714c8..16d5b00 100644
--- a/gitinspector/metrics.py
+++ b/gitinspector/metrics.py
@@ -49,7 +49,7 @@ class MetricsLogic:
self.cyclomatic_complexity = {}
self.cyclomatic_complexity_density = {}
- ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()], bufsize=1,
+ ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()],
stdout=subprocess.PIPE).stdout
for i in ls_tree_r.readlines():
@@ -59,7 +59,7 @@ class MetricsLogic:
if FileDiff.is_valid_extension(i) and not filtering.set_filtered(FileDiff.get_filename(i)):
file_r = subprocess.Popen(["git", "show", interval.get_ref() + ":{0}".format(i.strip())],
- bufsize=1, stdout=subprocess.PIPE).stdout.readlines()
+ stdout=subprocess.PIPE).stdout.readlines()
extension = FileDiff.get_extension(i)
lines = MetricsLogic.get_eloc(file_r, extension)
|