Skip to content

Commit 6217a3b

Browse files
authored
converts subprocess outputs to text for user ids (#53)
* converts subprocess outputs to text for user ids * updated flake8 url * fix black formatting * try to fix safety failures * disable pylint error
1 parent 1f7faee commit 6217a3b

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434
rev: 5.10.1
3535
hooks:
3636
- id: isort
37-
- repo: https://gitlab.com/pycqa/flake8
37+
- repo: https://github.com/pycqa/flake8
3838
rev: 5.0.4
3939
hooks:
4040
- id: flake8

noxfile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def safety(session: nox.Session) -> None:
3737
"""Scan dependencies for insecure packages."""
3838
session.install(".[dev]")
3939
session.install("safety")
40-
session.run("safety", "check", "--full-report")
40+
# Ignore https://github.com/pytest-dev/py/issues/287
41+
session.run("safety", "check", "--full-report", "-i", "51457")
4142

4243

4344
@nox.session

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install_requires=
3131

3232
[options.extras_require]
3333
tests =
34-
pytest==7.1.2
34+
pytest==7.2.0
3535
pytest-sugar==0.9.5
3636
pytest-cov==3.0.0
3737
pytest-mock==3.8.2

src/iterative_telemetry/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
@dataclasses.dataclass
3434
class TelemetryEvent:
35+
# pylint: disable=multiple-statements
3536
interface: str
3637
action: str
3738
error: Optional[str] = None
@@ -283,7 +284,8 @@ def _generate_github_id():
283284
group_id = f"{server_url}/{os.path.dirname(repository)}"
284285
try:
285286
user_id = subprocess.check_output( # nosec B603, B607
286-
["gh", "api", f"users/{actor}", "--jq", ".name, .login, .id"]
287+
["gh", "api", f"users/{actor}", "--jq", ".name, .login, .id"],
288+
text=True,
287289
)
288290
except subprocess.SubprocessError:
289291
return None
@@ -316,7 +318,7 @@ def _generate_bitbucket_id():
316318
return None
317319
try:
318320
user_id = subprocess.check_output( # nosec B603, B607
319-
["git", "log", "-1", "--pretty=format:'%ae'"]
321+
["git", "log", "-1", "--pretty=format:'%ae'"], text=True
320322
)
321323
return group_id, user_id
322324
except subprocess.SubprocessError:

0 commit comments

Comments
 (0)