Skip to content

Commit 7d8684a

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into pathsec
2 parents f989dea + f76dc7e commit 7d8684a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+337
-183
lines changed

.github/workflows/retest-pr.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Retest PR
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
env:
8+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
9+
10+
jobs:
11+
retest:
12+
if: github.event.issue.pull_request && contains(github.event.comment.body, 'retest')
13+
runs-on: ubuntu-latest
14+
permissions:
15+
actions: write
16+
issues: write
17+
pull-requests: read
18+
steps:
19+
- name: Check authorization and trigger phrase
20+
uses: actions/github-script@v7
21+
with:
22+
script: |
23+
const assoc = context.payload.comment.author_association;
24+
if (!['OWNER', 'MEMBER', 'COLLABORATOR'].includes(assoc)) {
25+
core.setFailed('Not authorized (association: ' + assoc + ')');
26+
return;
27+
}
28+
const body = context.payload.comment.body;
29+
if (!body.includes('/retest') &&
30+
!body.includes('[CI: retest]') &&
31+
!body.includes('[ci: retest]')) {
32+
core.setFailed('No recognized retest trigger found.');
33+
}
34+
35+
- name: Get PR head SHA
36+
id: pr
37+
uses: actions/github-script@v7
38+
with:
39+
script: |
40+
const pr = (await github.rest.pulls.get({
41+
owner: context.repo.owner,
42+
repo: context.repo.repo,
43+
pull_number: context.issue.number,
44+
})).data;
45+
core.setOutput('sha', pr.head.sha);
46+
47+
- name: Re-run CI
48+
uses: actions/github-script@v7
49+
with:
50+
script: |
51+
const runs = await github.rest.actions.listWorkflowRuns({
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
workflow_id: 'ci.yml',
55+
head_sha: '${{ steps.pr.outputs.sha }}',
56+
per_page: 1,
57+
});
58+
if (runs.data.workflow_runs.length === 0) {
59+
core.setFailed('No CI run found for this PR head SHA.');
60+
return;
61+
}
62+
const run = runs.data.workflow_runs[0];
63+
if (run.status === 'completed') {
64+
await github.rest.actions.reRunWorkflow({
65+
owner: context.repo.owner,
66+
repo: context.repo.repo,
67+
run_id: run.id,
68+
});
69+
} else {
70+
core.info('CI is already running (status: ' + run.status + '). Nothing to re-run.');
71+
}

.github/workflows/retest.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,21 @@ repos:
88
- id: requirements-txt-fixer
99
- id: check-yaml
1010
- repo: https://github.com/asottile/pyupgrade
11-
rev: v3.21.1
11+
rev: v3.21.2
1212
hooks:
1313
- id: pyupgrade
14-
args: ["--py38-plus"]
15-
- repo: https://github.com/ambv/black
16-
rev: 25.9.0
14+
args: ["--py310-plus"]
15+
- repo: https://github.com/psf/black
16+
rev: 25.11.0
1717
hooks:
1818
- id: black
19-
- repo: local
19+
- repo: https://github.com/pycqa/isort
20+
rev: 6.1.0
2021
hooks:
21-
- id: isort
22-
name: isort
23-
entry: isort
24-
require_serial: true
25-
language: python
26-
language_version: python3
27-
types_or: [cython, pyi, python]
28-
args: ['--filter-files']
29-
minimum_pre_commit_version: '2.9.2'
30-
additional_dependencies: ['isort==6.0.1']
22+
- id: isort
23+
args: ['--filter-files']
24+
- repo: https://github.com/astral-sh/ruff-pre-commit
25+
rev: v0.15.6
26+
hooks:
27+
- id: ruff
28+
args: [--fix]

nltk/app/wordnet_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def _synset_relations(word, synset, synset_relations):
611611
:rtype: str
612612
"""
613613

614-
if not synset.name() in synset_relations:
614+
if synset.name() not in synset_relations:
615615
return ""
616616
ref = Reference(word, synset_relations)
617617

nltk/ccg/combinator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def can_combine(self, function, argument):
110110
if not function.is_function():
111111
return False
112112

113-
return not function.arg().can_unify(argument) is None
113+
return function.arg().can_unify(argument) is not None
114114

115115
def combine(self, function, argument):
116116
if not function.is_function():
@@ -158,7 +158,7 @@ def can_combine(self, function, argument):
158158
if not (function.is_function() and argument.is_function()):
159159
return False
160160
if function.dir().can_compose() and argument.dir().can_compose():
161-
return not function.arg().can_unify(argument.res()) is None
161+
return function.arg().can_unify(argument.res()) is not None
162162
return False
163163

164164
def combine(self, function, argument):

nltk/chunk/named_entity.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def cmp_chunks(correct, guessed):
307307
if ct == gt == "O":
308308
if not ellipsis:
309309
print(f" {ct:15} {gt:15} {w}")
310-
print(" {:15} {:15} {2}".format("...", "...", "..."))
310+
print(" {:15} {:15} {}".format("...", "...", "..."))
311311
ellipsis = True
312312
else:
313313
ellipsis = False
@@ -323,7 +323,6 @@ class Maxent_NE_Chunker(NEChunkParser):
323323
"""
324324

325325
def __init__(self, fmt="multiclass"):
326-
from nltk.data import find
327326

328327
self._fmt = fmt
329328
self._tab_dir = find(f"chunkers/maxent_ne_chunker_tab/english_ace_{fmt}/")

nltk/classify/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def partial_names_demo(trainer, features=names_demo_features):
272272
print()
273273
print("Unseen Names P(Male) P(Female)\n" + "-" * 40)
274274
for (name, is_male), pdist in zip(test, pdists)[:5]:
275-
if is_male == True:
275+
if is_male:
276276
fmt = " %-15s *%6.4f %6.4f"
277277
else:
278278
fmt = " %-15s %6.4f *%6.4f"

nltk/collections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ def iterate_from(self, index):
417417
for iterator in iterators:
418418
try:
419419
elements.append(next(iterator))
420-
except: # FIXME: What is this except really catching? StopIteration?
420+
# FIXME: What is this except really catching? StopIteration?
421+
except StopIteration:
421422
elements.append(None)
422423
if elements == [None] * len(self._lists):
423424
return

nltk/collocations.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
QuadgramAssocMeasures,
4040
TrigramAssocMeasures,
4141
)
42-
from nltk.metrics.spearman import ranks_from_scores, spearman_correlation
4342
from nltk.probability import FreqDist
4443
from nltk.util import ngrams
4544

nltk/corpus/reader/childes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def _get_words(
440440
# relational
441441
# the gold standard is stored in
442442
# <mor></mor><mor type="trn"><gra type="grt">
443-
if relation == True:
443+
if relation:
444444
for xmlstem_rel in xmlword.findall(
445445
f".//{{{NS}}}mor/{{{NS}}}gra"
446446
):

0 commit comments

Comments
 (0)