2
0
Эх сурвалжийг харах

Misc fixes (#1625)

* Fix docstring formatting
* Add comments to CLAUDE.md
Jelmer Vernooij 1 сар өмнө
parent
commit
ba0d70932a

+ 5 - 0
CLAUDE.md

@@ -23,3 +23,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
 - All contributions must be under Apache License 2.0+ or GPL 2.0+
 - All contributions must be under Apache License 2.0+ or GPL 2.0+
 - When adding new test files, ensure the test accumulation functions are updated
 - When adding new test files, ensure the test accumulation functions are updated
   (i.e. ``self_test_suite()`` in `tests/__init__.py` or ``test_suite()`` in `tests/compat/__init__.py`)
   (i.e. ``self_test_suite()`` in `tests/__init__.py` or ``test_suite()`` in `tests/compat/__init__.py`)
+- Do not ignore exceptions. Never catch ``Exception`` unless you're going to
+  re-raise it, always something more specific. Catch specific exceptions. Don't catch OSError, but specific subclasses.
+- Keep code in try/except blocks to a minimum, and use else:. This keeps the code that can raise an exception
+  to a minimum.
+- There is almost never a good reason to catch AttributeError.

+ 1 - 1
dulwich/object_store.py

@@ -1390,7 +1390,7 @@ class DiskObjectStore(PackBasedObjectStore):
         """Prune/clean up this object store.
         """Prune/clean up this object store.
 
 
         This removes temporary files that were left behind by interrupted
         This removes temporary files that were left behind by interrupted
-        pack operations. These are files that start with 'tmp_pack_' in the
+        pack operations. These are files that start with ``tmp_pack_`` in the
         repository directory or files with .pack extension but no corresponding
         repository directory or files with .pack extension but no corresponding
         .idx file in the pack directory.
         .idx file in the pack directory.
 
 

+ 1 - 1
dulwich/porcelain.py

@@ -3146,7 +3146,7 @@ def cherry_pick(
       repo: Repository to cherry-pick into
       repo: Repository to cherry-pick into
       committish: Commit to cherry-pick
       committish: Commit to cherry-pick
       no_commit: If True, do not create a commit after applying changes
       no_commit: If True, do not create a commit after applying changes
-      continue\\_: Continue an in-progress cherry-pick after resolving conflicts
+      continue\_: Continue an in-progress cherry-pick after resolving conflicts
       abort: Abort an in-progress cherry-pick
       abort: Abort an in-progress cherry-pick
 
 
     Returns:
     Returns: