Skip to content

Commit e335da8

Browse files
committed
[GR-47565] Patch for flake8 and category-encoders.
PullRequest: graalpython/3256
2 parents 87a62a8 + 0ced609 commit e335da8

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ def run_with_timeout(cmd, *, timeout, **kwargs):
229229
print("Cannot find the 'timeout' GNU tool. Do you have coreutils installed?")
230230
else:
231231
timeout_cmd = p[1].strip()
232-
cmd = [timeout_cmd, "-k", "10", str(timeout)] + cmd
232+
# signal nr. 2 is SIGINT; this has better chances to print a Python traceback
233+
cmd = [timeout_cmd, "-s", "2", "-k", "10", str(timeout)] + cmd
233234
return subprocess.run(cmd, **kwargs)
234235

235236

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/category_encoders/hashing.py b/category_encoders/hashing.py
2+
index d366908..9b2ae78 100644
3+
--- a/category_encoders/hashing.py
4+
+++ b/category_encoders/hashing.py
5+
@@ -114,7 +114,10 @@ class HashingEncoder(util.BaseEncoder, util.UnsupervisedTransformerMixin):
6+
if platform.system == 'Windows':
7+
self.max_process = 1
8+
else:
9+
- self.max_process = int(math.ceil(multiprocessing.cpu_count() / 2))
10+
+ if sys.implementation.name == 'graalpy':
11+
+ self.max_process = __graalpython__.get_max_process_count()
12+
+ else:
13+
+ self.max_process = int(math.ceil(multiprocessing.cpu_count() / 2))
14+
if self.max_process < 1:
15+
self.max_process = 1
16+
elif self.max_process > 128:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[rules]]
2+
version = '== 2.5.1.post0'
3+
patch = 'category-encoders-2.5.1.post0.patch'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/flake8/checker.py b/flake8/checker.py
2+
--- a/flake8/checker.py
3+
+++ b/flake8/checker.py
4+
@@ -1,6 +1,7 @@
5+
"""Checker Manager and Checker classes."""
6+
from __future__ import annotations
7+
8+
+import sys
9+
import argparse
10+
import contextlib
11+
import errno
12+
@@ -149,6 +150,8 @@ class Manager:
13+
# default to 1
14+
if jobs.is_auto:
15+
try:
16+
+ if sys.implementation.name == 'graalpy':
17+
+ return 0
18+
return multiprocessing.cpu_count()
19+
except NotImplementedError:
20+
return 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[rules]]
2+
version = '== 6.0.0'
3+
patch = 'flake8-6.0.0.patch'

0 commit comments

Comments
 (0)