[Pywikibot-commits] [Gerrit] ...core[master]: [bugfix] Fix TypeError in colors.py with backports.batched

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017485?usp=email )

Change subject: [bugfix] Fix TypeError in colors.py with backports.batched
..

[bugfix] Fix TypeError in colors.py with backports.batched

Bug: T362035
Change-Id: I68d7a7c3451fce91e13385a57138c0ed50f26d64
Signed-off-by: Xqt 
---
M pywikibot/backports.py
M scripts/maintenance/colors.py
2 files changed, 19 insertions(+), 6 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 155effd..8b9d989 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -177,9 +177,13 @@
 :param strict: raise a ValueError if the final batch is shorter
 than *n*.
 :raise ValueError: batched(): incomplete batch
+:raise TypeError: *n* cannot be interpreted as an integer
 """
 msg = 'batched(): incomplete batch'
 if PYTHON_VERSION < (3, 12):
+if not isinstance(n, int):
+raise TypeError(f'{type(n),__name__!r} object cannot be'
+' interpreted as an integer')
 group = []
 for item in iterable:
 group.append(item)
diff --git a/scripts/maintenance/colors.py b/scripts/maintenance/colors.py
index bf73742..63c46a5 100755
--- a/scripts/maintenance/colors.py
+++ b/scripts/maintenance/colors.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 """Utility to show pywikibot colors."""
 #
-# (C) Pywikibot team, 2016-2023
+# (C) Pywikibot team, 2016-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -17,10 +17,8 @@
 fg_colors = [col for col in colors if col != 'default']
 bg_colors = fg_colors[:]
 n_fg_colors = len(fg_colors)
-fg_colors.insert(3 * int(n_fg_colors / 4), 'default')
-fg_colors.insert(2 * int(n_fg_colors / 4), 'default')
-fg_colors.insert(int(n_fg_colors / 4), 'default')
-fg_colors.insert(0, 'default')
+for i in range(4):
+fg_colors.insert((3 - i) * (n_fg_colors // 4), 'default')

 # Max len of color names for padding.
 max_len_fg_colors = len(max(fg_colors, key=len))
@@ -28,7 +26,7 @@

 for bg_col in bg_colors:
 # Three lines per each backgoung color.
-for fg_col_group in batched(fg_colors, n_fg_colors / 4 + 1):
+for fg_col_group in batched(fg_colors, n_fg_colors // 4 + 1):
 line = ''
 for fg_col in fg_col_group:
 line += ' '

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017485?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I68d7a7c3451fce91e13385a57138c0ed50f26d64
Gerrit-Change-Number: 1017485
Gerrit-PatchSet: 8
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Meno25 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] bugfix for pip upgrade

2024-04-07 Thread Xqt (Code Review)
Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017514?usp=email )

Change subject: [doc] bugfix for pip upgrade
..

[doc] bugfix for pip upgrade

Bug: T361999
Change-Id: Iea20d29bd050ab62f0fcd55a5cc7ec6175cb1c36
---
M .appveyor.yml
1 file changed, 12 insertions(+), 4 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index d81a168..6fb8acf 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -64,7 +64,7 @@
   - mkdir appveyor
   - python --version
   - python -c "import struct; print('PYTHON_ARCH:', struct.calcsize('P') << 3)"
-  - pip install --upgrade pip
+  - python -m pip install --upgrade pip
   - pip --version
   - if [%PYTHON_VERSION%]==[3.7.0] pip install "urllib3<2.0"
   - if [%PYTHON_VERSION%]==[3.7.0] pip install -U setuptools
@@ -94,11 +94,9 @@

   - "%CMD_IN_ENV% coverage run -m unittest discover -vv -p \"*_tests.py\""

-after_test:
+on_finish:
   - ps: |
   $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
   coverage report
-
-on_finish:
   - pip install codecov-cli
   - codecovcli do-upload

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017514?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Iea20d29bd050ab62f0fcd55a5cc7ec6175cb1c36
Gerrit-Change-Number: 1017514
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] Update pip first to prevent installing the wrong codecov-cli ...

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017513?usp=email )

Change subject: [tests] Update pip first to prevent installing the wrong 
codecov-cli release
..

[tests] Update pip first to prevent installing the wrong codecov-cli release

Bug: T361999
Change-Id: I937435daa3013293e979d0a3d02d8dd47bd9ed51
---
M .appveyor.yml
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index 4cba969..d81a168 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -64,6 +64,7 @@
   - mkdir appveyor
   - python --version
   - python -c "import struct; print('PYTHON_ARCH:', struct.calcsize('P') << 3)"
+  - pip install --upgrade pip
   - pip --version
   - if [%PYTHON_VERSION%]==[3.7.0] pip install "urllib3<2.0"
   - if [%PYTHON_VERSION%]==[3.7.0] pip install -U setuptools

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017513?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I937435daa3013293e979d0a3d02d8dd47bd9ed51
Gerrit-Change-Number: 1017513
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [doc] update ROADMAP.rst

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017512?usp=email )

Change subject: [doc] update ROADMAP.rst
..

[doc] update ROADMAP.rst

Change-Id: I992550ef6b9b82e3819a48b44599485c42bc2b0a
---
M ROADMAP.rst
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/ROADMAP.rst b/ROADMAP.rst
index b00b932..850f0a3 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -1,7 +1,14 @@
 Current release
 ---

-* (no changes yet)
+* File title of :class:`specialbots.UploadRobot` must have a valid file 
extension (:phab:`T345786`)
+* Add a :attr:`post_processor` 
attribute to :class:`specialbots.UploadRobot`
+  which can be called after each upload (:phab:`T359766`)
+* Avoid using :meth:`pywikibot.handle_args` in private scripts;
+  use :mod:`pwb` wrapper instead (:phab:`T359766`)
+* Show upload count with :class:`specialbots.UploadRobot`
+* Use the same ``iiprop`` properties in :class:`data.api.PageGenerator` as in
+  :meth:`APISite.loadimageinfo` 
(:phab:`T360093`)

 Deprecations
 

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017512?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I992550ef6b9b82e3819a48b44599485c42bc2b0a
Gerrit-Change-Number: 1017512
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [fix] file title must have a valid file extension

2024-04-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015994?usp=email )

Change subject: [fix] file title must have a valid file extension
..

[fix] file title must have a valid file extension

An invalid file extension will lead to a ValueError.
Skip the current file or retry to enter a valid filename.

Bug: T345786
Change-Id: Ie95c837156d893e2e8faa6eaac96fc95a63531a8
---
M pywikibot/specialbots/_upload.py
1 file changed, 20 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/specialbots/_upload.py b/pywikibot/specialbots/_upload.py
index ce8bd29..0aad35d 100644
--- a/pywikibot/specialbots/_upload.py
+++ b/pywikibot/specialbots/_upload.py
@@ -3,7 +3,7 @@
 Do not import classes directly from here but from specialbots.
 """
 #
-# (C) Pywikibot team, 2003-2023
+# (C) Pywikibot team, 2003-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -270,13 +270,13 @@
 if self.opt.always:
 pywikibot.info('File format is not one of [{}]'
.format(' '.join(allowed_formats)))
-continue

-if not pywikibot.input_yn(
-'File format is not one of [{}], but {!r}. Continue?'
-.format(' '.join(allowed_formats), ext),
-default=False):
-continue
+elif pywikibot.input_yn(
+'File format is not one of [{}], but {!r}. Skip?'
+.format(' '.join(allowed_formats), ext)):
+return None
+
+continue

 potential_file_page = pywikibot.FilePage(self.target_site,
  filename)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1015994?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie95c837156d893e2e8faa6eaac96fc95a63531a8
Gerrit-Change-Number: 1015994
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org


[Pywikibot-commits] [Gerrit] ...core[master]: [tests] use new codecov-cli package for upload

2024-04-07 Thread Xqt (Code Review)
Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017511?usp=email )

Change subject: [tests] use new codecov-cli package for upload
..

[tests] use new codecov-cli package for upload

The previously used bash uploader is deprecated.

Change-Id: Ie02a7307877b84916677071123722bcfd94ab423
---
M .appveyor.yml
1 file changed, 16 insertions(+), 3 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/.appveyor.yml b/.appveyor.yml
index cf2b780..4cba969 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -93,9 +93,11 @@

   - "%CMD_IN_ENV% coverage run -m unittest discover -vv -p \"*_tests.py\""

-on_finish:
+after_test:
   - ps: |
   $env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
   coverage report
-  Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
-  bash codecov.sh -U "-s" -A "-s"
+
+on_finish:
+  - pip install codecov-cli
+  - codecovcli do-upload

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1017511?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie02a7307877b84916677071123722bcfd94ab423
Gerrit-Change-Number: 1017511
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-MessageType: merged
___
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org