Skip to content

Instantly share code, notes, and snippets.

@jaraco
jaraco / qce.txt
Created September 27, 2024 20:59
Quick code examples demonstrating Python unpacking
Example 1.A - Multiple assignment using a list
>>> a, b, c = [1, 2, 3]
>>> a
1
>>> b
2
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 9b66a9f054d..b21889694da 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -2188,10 +2188,33 @@ def _difference(minuend, subtrahend):
return itertools.filterfalse(set(subtrahend).__contains__, minuend)
-class CompleteDirs(ZipFile):
+class InitializedState:
{"boto3": ["boto3"]}
{"urllib3": ["urllib3"]}
{"botocore": ["botocore"]}
{"requests": ["requests"]}
{"certifi": ["certifi"]}
{"typing-extensions": ["typing_extensions"]}
{"idna": ["idna"]}
{"charset-normalizer": ["charset_normalizer"]}
{"python-dateutil": ["dateutil"]}
{"setuptools": ["_distutils_hack", "pkg_resources", "setuptools"]}
from typing import Iterable
def unique(items):
return list(dict.fromkeys(items))
class Tree:
def __init__(self, paths, at=""):
self.paths = tuple(paths)
🐚 pip install --disable-pip-version-check --quiet --ignore-installed --dry-run --report - coherent.build | jq '.install | .[].metad
ata| {name,version}'
{
"name": "coherent.build",
"version": "0.19.3"
}
{
"name": "jaraco.compat",
"version": "4.2.1"
}
distutils main @ git rebase -i 55982565e --rebase-merges
[detached HEAD 491cd2473] Merge pull request pypa/distutils#245 from DimitriPapadopoulos/FURB
Date: Sat Apr 13 09:32:32 2024 -0400
[detached HEAD b3406caf9] Merge pull request pypa/distutils#247 from pypa/hotfix/246-linker-args-list
Date: Sat Apr 13 16:40:32 2024 -0400
[detached HEAD 20a372ef0] Merge pull request pypa/distutils#239 from DimitriPapadopoulos/extra_pairs_of_quotes
Date: Sat Apr 13 20:16:59 2024 -0400
Auto-merging pyproject.toml
CONFLICT (content): Merge conflict in pyproject.toml
Recorded preimage for 'pyproject.toml'
When rebasing a merge in git, is there a way to re-use an existing conflict resolution?
Show drafts
Yes, there are a few ways to reuse existing conflict resolutions when rebasing a merge in Git:
1. Rerere (Reuse Recorded Resolution):
Git has a built-in mechanism called "rerere" (reuse recorded resolution) that can automatically reuse previously resolved conflicts.
Enable it with git config --global rerere.enabled true.
When you encounter a conflict that you've already resolved before, Git will attempt to apply the same resolution.
label onto
# Branch DimitriPapadopoulos-FURB
reset onto
pick ea55396cc Apply ruff/refurb rule (FURB105)
pick 0d6794fdc Apply ruff/refurb rule (FURB129)
pick bfadc24bc Apply ruff/refurb rule (FURB142)
pick ec303d596 Apply ruff/refurb rule (FURB140)
pick 8b9f35e00 Construct the set in one expression.
label DimitriPapadopoulos-FURB
~ @# xpip install -U --force-reinstall git+https://github.com/xonsh/xonsh@executables
Collecting git+https://github.com/xonsh/xonsh@executables
Cloning https://github.com/xonsh/xonsh (to revision executables) to c:\users\jaraco\appdata\local\temp\pip-req-build-sgylurfx
Running command git clone --filter=blob:none --quiet https://github.com/xonsh/xonsh 'C:\Users\jaraco\AppData\Local\Temp\pip-req-build-sgylurfx'
Running command git checkout -b executables --track origin/executables
branch 'executables' set up to track 'origin/executables'.
Switched to a new branch 'executables'
Resolved https://github.com/xonsh/xonsh to commit 17638c766e8d288540d202c8e99992a0989d2ce4
Installing build dependencies ... done
Getting requirements to build wheel ... done
diff --git a/pyproject.toml b/pyproject.toml
index 8434a08..b067201 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,7 +39,6 @@ dependencies = [
"keyring >= 15.1",
"rfc3986 >= 1.4.0",
"rich >= 12.0.0",
- "packaging",
]