Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some refurb suggestions #763

Merged
merged 7 commits into from Jan 12, 2024
Merged

Conversation

DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Jan 5, 2024

I am reopening #759 with more focused changes as suggested.

These are not bug fixes, just refactoring. However:

  • The resulting code is easier to read, leaner, faster.
  • I find these specific refurb warnings useful for new code. I could add the relevant linter rules once the old issues are fixed.

[FURB108]: Replace `x == y or x == z` with `x in (y, z)`
[FURB110]: Replace `x if x else y` with `x or y`
[FURB142]: Replace `for x in y: s.add(...)` with `s.update(... for x in y)`
[FURB179]: Replace `itertools.chain(*x)` with `itertools.chain.from_iterable(x)`
@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review January 5, 2024 08:08
@pradyunsg pradyunsg changed the title Appply some refurb suggestions Apply some refurb suggestions Jan 5, 2024
src/packaging/specifiers.py Outdated Show resolved Hide resolved
src/packaging/tags.py Outdated Show resolved Hide resolved
DimitriPapadopoulos and others added 2 commits January 5, 2024 10:08
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
The result is less readable.
@brettcannon brettcannon merged commit 7bcd6d8 into pypa:main Jan 12, 2024
32 checks passed
lengau pushed a commit to canonical/charmcraft that referenced this pull request Mar 14, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [packaging](https://togithub.com/pypa/packaging) | `==23.2` ->
`==24.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/packaging/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/packaging/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/packaging/23.2/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/packaging/23.2/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pypa/packaging (packaging)</summary>

### [`v24.0`](https://togithub.com/pypa/packaging/releases/tag/24.0)

[Compare
Source](https://togithub.com/pypa/packaging/compare/23.2...24.0)

#### What's Changed

- Fix specifier matching when the specifier is long and has an epoch by
[@&#8203;SpecLad](https://togithub.com/SpecLad) in
[pypa/packaging#712
- Clarify version split/join usage by
[@&#8203;uranusjr](https://togithub.com/uranusjr) in
[pypa/packaging#725
- Default optional metadata values to None by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#734
- Stop using deprecated/removed keys by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#739
- Correctly use the ExceptionGroup shim only when needed by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#736
- Update CHANGELOG entry about `validate` kwarg by
[@&#8203;pradyunsg](https://togithub.com/pradyunsg) in
[pypa/packaging#731
- Support --disable-gil builds (PEP 703) in packaging.tags by
[@&#8203;colesbury](https://togithub.com/colesbury) in
[pypa/packaging#728
- Skip `test_glibc_version_string_ctypes_raise_oserror` if `ctypes` is
unavailable by [@&#8203;kevinchang96](https://togithub.com/kevinchang96)
in
[pypa/packaging#741
- Enable CodeQL by [@&#8203;joycebrum](https://togithub.com/joycebrum)
in
[pypa/packaging#743
- PEP 703: Rename `Py_NOGIL` to `Py_GIL_DISABLED` by
[@&#8203;hugovk](https://togithub.com/hugovk) in
[pypa/packaging#747
- Replace PEP references with PUG links by
[@&#8203;jeanas](https://togithub.com/jeanas) in
[pypa/packaging#750
- Remove coverage ignore for non-existent file by
[@&#8203;shenanigansd](https://togithub.com/shenanigansd) in
[pypa/packaging#752
- Update URLs by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#764
- Configure dependabot by
[@&#8203;joycebrum](https://togithub.com/joycebrum) in
[pypa/packaging#757
- Hash pin github actions by
[@&#8203;joycebrum](https://togithub.com/joycebrum) in
[pypa/packaging#758
- Apply some refurb suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#763
- Appply some bugbear suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#761
- Apply some ruff suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#772
- Add riscv64 as a supported manylinux architecture by
[@&#8203;markdryan](https://togithub.com/markdryan) in
[pypa/packaging#751

#### New Contributors

- [@&#8203;colesbury](https://togithub.com/colesbury) made their first
contribution in
[pypa/packaging#728
- [@&#8203;kevinchang96](https://togithub.com/kevinchang96) made their
first contribution in
[pypa/packaging#741
- [@&#8203;jeanas](https://togithub.com/jeanas) made their first
contribution in
[pypa/packaging#750
- [@&#8203;shenanigansd](https://togithub.com/shenanigansd) made their
first contribution in
[pypa/packaging#752
- [@&#8203;markdryan](https://togithub.com/markdryan) made their first
contribution in
[pypa/packaging#751

**Full Changelog**:
pypa/packaging@23.2...24.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" in timezone Etc/UTC,
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/canonical/charmcraft).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzguMSIsInVwZGF0ZWRJblZlciI6IjM3LjIzOC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
kodiakhq bot pushed a commit to cloudquery/plugin-sdk-python that referenced this pull request Apr 1, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [packaging](https://togithub.com/pypa/packaging) | major | `==23.2` -> `==24.0` |

---

### Release Notes

<details>
<summary>pypa/packaging (packaging)</summary>

### [`v24.0`](https://togithub.com/pypa/packaging/releases/tag/24.0)

[Compare Source](https://togithub.com/pypa/packaging/compare/23.2...24.0)

#### What's Changed

-   Fix specifier matching when the specifier is long and has an epoch by [@&#8203;SpecLad](https://togithub.com/SpecLad) in [pypa/packaging#712
-   Clarify version split/join usage by [@&#8203;uranusjr](https://togithub.com/uranusjr) in [pypa/packaging#725
-   Default optional metadata values to None by [@&#8203;dstufft](https://togithub.com/dstufft) in [pypa/packaging#734
-   Stop using deprecated/removed keys by [@&#8203;dstufft](https://togithub.com/dstufft) in [pypa/packaging#739
-   Correctly use the ExceptionGroup shim only when needed by [@&#8203;dstufft](https://togithub.com/dstufft) in [pypa/packaging#736
-   Update CHANGELOG entry about `validate` kwarg by [@&#8203;pradyunsg](https://togithub.com/pradyunsg) in [pypa/packaging#731
-   Support --disable-gil builds (PEP 703) in packaging.tags by [@&#8203;colesbury](https://togithub.com/colesbury) in [pypa/packaging#728
-   Skip `test_glibc_version_string_ctypes_raise_oserror` if `ctypes` is unavailable by [@&#8203;kevinchang96](https://togithub.com/kevinchang96) in [pypa/packaging#741
-   Enable CodeQL by [@&#8203;joycebrum](https://togithub.com/joycebrum) in [pypa/packaging#743
-   PEP 703: Rename `Py_NOGIL` to `Py_GIL_DISABLED` by [@&#8203;hugovk](https://togithub.com/hugovk) in [pypa/packaging#747
-   Replace PEP references with PUG links by [@&#8203;jeanas](https://togithub.com/jeanas) in [pypa/packaging#750
-   Remove coverage ignore for non-existent file by [@&#8203;shenanigansd](https://togithub.com/shenanigansd) in [pypa/packaging#752
-   Update URLs by [@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos) in [pypa/packaging#764
-   Configure dependabot by [@&#8203;joycebrum](https://togithub.com/joycebrum) in [pypa/packaging#757
-   Hash pin github actions by [@&#8203;joycebrum](https://togithub.com/joycebrum) in [pypa/packaging#758
-   Apply some refurb suggestions by [@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos) in [pypa/packaging#763
-   Appply some bugbear suggestions by [@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos) in [pypa/packaging#761
-   Apply some ruff suggestions by [@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos) in [pypa/packaging#772
-   Add riscv64 as a supported manylinux architecture by [@&#8203;markdryan](https://togithub.com/markdryan) in [pypa/packaging#751

#### New Contributors

-   [@&#8203;colesbury](https://togithub.com/colesbury) made their first contribution in [pypa/packaging#728
-   [@&#8203;kevinchang96](https://togithub.com/kevinchang96) made their first contribution in [pypa/packaging#741
-   [@&#8203;jeanas](https://togithub.com/jeanas) made their first contribution in [pypa/packaging#750
-   [@&#8203;shenanigansd](https://togithub.com/shenanigansd) made their first contribution in [pypa/packaging#752
-   [@&#8203;markdryan](https://togithub.com/markdryan) made their first contribution in [pypa/packaging#751

**Full Changelog**: pypa/packaging@23.2...24.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNzguMCIsInVwZGF0ZWRJblZlciI6IjM3LjI3OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
holtskinner pushed a commit to GoogleCloudPlatform/generative-ai that referenced this pull request Apr 24, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [packaging](https://togithub.com/pypa/packaging) | `==23.2` ->
`==24.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/packaging/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/packaging/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/packaging/23.2/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/packaging/23.2/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pypa/packaging (packaging)</summary>

### [`v24.0`](https://togithub.com/pypa/packaging/releases/tag/24.0)

[Compare
Source](https://togithub.com/pypa/packaging/compare/23.2...24.0)

#### What's Changed

- Fix specifier matching when the specifier is long and has an epoch by
[@&#8203;SpecLad](https://togithub.com/SpecLad) in
[pypa/packaging#712
- Clarify version split/join usage by
[@&#8203;uranusjr](https://togithub.com/uranusjr) in
[pypa/packaging#725
- Default optional metadata values to None by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#734
- Stop using deprecated/removed keys by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#739
- Correctly use the ExceptionGroup shim only when needed by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#736
- Update CHANGELOG entry about `validate` kwarg by
[@&#8203;pradyunsg](https://togithub.com/pradyunsg) in
[pypa/packaging#731
- Support --disable-gil builds (PEP 703) in packaging.tags by
[@&#8203;colesbury](https://togithub.com/colesbury) in
[pypa/packaging#728
- Skip `test_glibc_version_string_ctypes_raise_oserror` if `ctypes` is
unavailable by [@&#8203;kevinchang96](https://togithub.com/kevinchang96)
in
[pypa/packaging#741
- Enable CodeQL by [@&#8203;joycebrum](https://togithub.com/joycebrum)
in
[pypa/packaging#743
- PEP 703: Rename `Py_NOGIL` to `Py_GIL_DISABLED` by
[@&#8203;hugovk](https://togithub.com/hugovk) in
[pypa/packaging#747
- Replace PEP references with PUG links by
[@&#8203;jeanas](https://togithub.com/jeanas) in
[pypa/packaging#750
- Remove coverage ignore for non-existent file by
[@&#8203;shenanigansd](https://togithub.com/shenanigansd) in
[pypa/packaging#752
- Update URLs by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#764
- Configure dependabot by
[@&#8203;joycebrum](https://togithub.com/joycebrum) in
[pypa/packaging#757
- Hash pin github actions by
[@&#8203;joycebrum](https://togithub.com/joycebrum) in
[pypa/packaging#758
- Apply some refurb suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#763
- Appply some bugbear suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#761
- Apply some ruff suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#772
- Add riscv64 as a supported manylinux architecture by
[@&#8203;markdryan](https://togithub.com/markdryan) in
[pypa/packaging#751

#### New Contributors

- [@&#8203;colesbury](https://togithub.com/colesbury) made their first
contribution in
[pypa/packaging#728
- [@&#8203;kevinchang96](https://togithub.com/kevinchang96) made their
first contribution in
[pypa/packaging#741
- [@&#8203;jeanas](https://togithub.com/jeanas) made their first
contribution in
[pypa/packaging#750
- [@&#8203;shenanigansd](https://togithub.com/shenanigansd) made their
first contribution in
[pypa/packaging#752
- [@&#8203;markdryan](https://togithub.com/markdryan) made their first
contribution in
[pypa/packaging#751

**Full Changelog**:
pypa/packaging@23.2...24.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/GoogleCloudPlatform/generative-ai).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjMxMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
kartikeygupta24 pushed a commit to nitchandak/generative-ai that referenced this pull request May 3, 2024
)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [packaging](https://togithub.com/pypa/packaging) | `==23.2` ->
`==24.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/packaging/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/packaging/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/packaging/23.2/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/packaging/23.2/24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pypa/packaging (packaging)</summary>

### [`v24.0`](https://togithub.com/pypa/packaging/releases/tag/24.0)

[Compare
Source](https://togithub.com/pypa/packaging/compare/23.2...24.0)

#### What's Changed

- Fix specifier matching when the specifier is long and has an epoch by
[@&#8203;SpecLad](https://togithub.com/SpecLad) in
[pypa/packaging#712
- Clarify version split/join usage by
[@&#8203;uranusjr](https://togithub.com/uranusjr) in
[pypa/packaging#725
- Default optional metadata values to None by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#734
- Stop using deprecated/removed keys by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#739
- Correctly use the ExceptionGroup shim only when needed by
[@&#8203;dstufft](https://togithub.com/dstufft) in
[pypa/packaging#736
- Update CHANGELOG entry about `validate` kwarg by
[@&#8203;pradyunsg](https://togithub.com/pradyunsg) in
[pypa/packaging#731
- Support --disable-gil builds (PEP 703) in packaging.tags by
[@&#8203;colesbury](https://togithub.com/colesbury) in
[pypa/packaging#728
- Skip `test_glibc_version_string_ctypes_raise_oserror` if `ctypes` is
unavailable by [@&#8203;kevinchang96](https://togithub.com/kevinchang96)
in
[pypa/packaging#741
- Enable CodeQL by [@&#8203;joycebrum](https://togithub.com/joycebrum)
in
[pypa/packaging#743
- PEP 703: Rename `Py_NOGIL` to `Py_GIL_DISABLED` by
[@&#8203;hugovk](https://togithub.com/hugovk) in
[pypa/packaging#747
- Replace PEP references with PUG links by
[@&#8203;jeanas](https://togithub.com/jeanas) in
[pypa/packaging#750
- Remove coverage ignore for non-existent file by
[@&#8203;shenanigansd](https://togithub.com/shenanigansd) in
[pypa/packaging#752
- Update URLs by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#764
- Configure dependabot by
[@&#8203;joycebrum](https://togithub.com/joycebrum) in
[pypa/packaging#757
- Hash pin github actions by
[@&#8203;joycebrum](https://togithub.com/joycebrum) in
[pypa/packaging#758
- Apply some refurb suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#763
- Appply some bugbear suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#761
- Apply some ruff suggestions by
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
in
[pypa/packaging#772
- Add riscv64 as a supported manylinux architecture by
[@&#8203;markdryan](https://togithub.com/markdryan) in
[pypa/packaging#751

#### New Contributors

- [@&#8203;colesbury](https://togithub.com/colesbury) made their first
contribution in
[pypa/packaging#728
- [@&#8203;kevinchang96](https://togithub.com/kevinchang96) made their
first contribution in
[pypa/packaging#741
- [@&#8203;jeanas](https://togithub.com/jeanas) made their first
contribution in
[pypa/packaging#750
- [@&#8203;shenanigansd](https://togithub.com/shenanigansd) made their
first contribution in
[pypa/packaging#752
- [@&#8203;markdryan](https://togithub.com/markdryan) made their first
contribution in
[pypa/packaging#751

**Full Changelog**:
pypa/packaging@23.2...24.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/GoogleCloudPlatform/generative-ai).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjMxMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants