Title: Add context manager lesson to usethis-python-code skill by Copilot · Pull Request #1787 · usethis-python/usethis-python · GitHub
Open Graph Title: Add context manager lesson to usethis-python-code skill by Copilot · Pull Request #1787 · usethis-python/usethis-python
X Title: Add context manager lesson to usethis-python-code skill by Copilot · Pull Request #1787 · usethis-python/usethis-python
Description: Documents the lesson from #1786: prefer @contextmanager over paired backup/restore helpers for setup/teardown logic. Added new "Preferring context managers for resource cleanup" section to usethis-python-code skill (v1.4 → v1.5) Includes procedure, key principle, before/after example, and common mistakes — matching existing section structure # Bad: caller manages lifecycle backup = _backup(lock_path) try: run_subprocess() finally: _restore(lock_path, backup) # Good: context manager encapsulates it with _preserved(lock_path): run_subprocess() Skills used: usethis-skills-modify, usethis-qa-static-checks
Open Graph Description: Documents the lesson from #1786: prefer @contextmanager over paired backup/restore helpers for setup/teardown logic. Added new "Preferring context managers for resource cleanup" section ...
X Description: Documents the lesson from #1786: prefer @contextmanager over paired backup/restore helpers for setup/teardown logic. Added new "Preferring context managers for resource cleanup" ...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1787
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:60c52b9d-d92d-db38-8007-847449a49c0d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A480:1C4EB2:A82E09:DF4912:6A4D4364 |
| html-safe-nonce | cbddfcdcd97eae202067050dcb8ac185e74a33c60060fba6c7de6af09f3bb72d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDgwOjFDNEVCMjpBODJFMDk6REY0OTEyOjZBNEQ0MzY0IiwidmlzaXRvcl9pZCI6IjUzODY4OTI2MzAzMzUyNDMxMDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d1985de604f05aaa5017960dd04229661fcecf7896491feb0f085e18180d410a |
| hovercard-subject-tag | pull_request:3487539681 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/usethis-python/usethis-python/pull/1787/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | Documents the lesson from #1786: prefer @contextmanager over paired backup/restore helpers for setup/teardown logic. Added new "Preferring context managers for resource cleanup" section ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width