mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	|  69ea1b3a8f Refactor simple dict.update calls
This commit refactors simple `dict.update({key: value})` calls which can
be done via `dict[key] = value` instead.
I found those cases with the [semgrep](https://semgrep.dev/) tool:
```
$ semgrep --lang python --pattern '$DICT.update({$A: ...})'
┌─────────────────┐
│ 5 Code Findings │
└─────────────────┘
    Lib/dataclasses.py
         1268┆ slots.update({slot: doc})
    Lib/multiprocessing/resource_tracker.py
           50┆ _CLEANUP_FUNCS.update({
           51┆     'semaphore': _multiprocessing.sem_unlink,
           52┆ })
            ⋮┆----------------------------------------
           53┆ _CLEANUP_FUNCS.update({
           54┆     'shared_memory': _posixshmem.shm_unlink,
           55┆ })
    Lib/tkinter/scrolledtext.py
           26┆ kw.update({'yscrollcommand': self.vbar.set})
    Lib/xmlrpc/server.py
          242┆ self.funcs.update({'system.multicall' : self.system_multicall})
``` | ||
|---|---|---|
| .. | ||
| dummy | ||
| __init__.py | ||
| connection.py | ||
| context.py | ||
| forkserver.py | ||
| heap.py | ||
| managers.py | ||
| pool.py | ||
| popen_fork.py | ||
| popen_forkserver.py | ||
| popen_spawn_posix.py | ||
| popen_spawn_win32.py | ||
| process.py | ||
| queues.py | ||
| reduction.py | ||
| resource_sharer.py | ||
| resource_tracker.py | ||
| shared_memory.py | ||
| sharedctypes.py | ||
| spawn.py | ||
| synchronize.py | ||
| util.py | ||