| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 141cd65 commit 4463624
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -735,6 +735,7 @@ def __init__(self, working_dir: Union[None, PathLike] = None): | |||
| 735 | 735 | def __getattr__(self, name: str) -> Any: | |
| 736 | 736 | """A convenience method as it allows to call the command as if it was | |
| 737 | 737 | an object. | |
| 738 | + | ||
| 738 | 739 | :return: Callable object that will execute call _call_process with your arguments.""" | |
| 739 | 740 | if name[0] == "_": | |
| 740 | 741 | return LazyMixin.__getattr__(self, name) | |
@@ -915,7 +916,7 @@ def execute( | |||
| 915 | 916 | render the repository incapable of accepting changes until the lock is manually | |
| 916 | 917 | removed. | |
| 917 | 918 | :param strip_newline_in_stdout: | |
| 918 | - Whether to strip the trailing `\n` of the command stdout. | ||
| 919 | + Whether to strip the trailing ``\\n`` of the command stdout. | ||
| 919 | 920 | :return: | |
| 920 | 921 | * str(output) if extended_output = False (Default) | |
| 921 | 922 | * tuple(int(status), str(stdout), str(stderr)) if extended_output = True | |
@@ -1384,7 +1385,8 @@ def get_object_header(self, ref: str) -> Tuple[str, str, int]: | |||
| 1384 | 1385 | ||
| 1385 | 1386 | def get_object_data(self, ref: str) -> Tuple[str, str, int, bytes]: | |
| 1386 | 1387 | """As get_object_header, but returns object data as well | |
| 1387 | - :return: (hexsha, type_string, size_as_int,data_string) | ||
| 1388 | + | ||
| 1389 | + :return: (hexsha, type_string, size_as_int, data_string) | ||
| 1388 | 1390 | :note: not threadsafe""" | |
| 1389 | 1391 | hexsha, typename, size, stream = self.stream_object_data(ref) | |
| 1390 | 1392 | data = stream.read(size) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -982,12 +982,12 @@ def move( | |||
| 982 | 982 | Additional arguments you would like to pass to git-mv, such as dry_run | |
| 983 | 983 | or force. | |
| 984 | 984 | ||
| 985 | - :return:List(tuple(source_path_string, destination_path_string), ...) | ||
| 985 | + :return: List(tuple(source_path_string, destination_path_string), ...) | ||
| 986 | 986 | A list of pairs, containing the source file moved as well as its | |
| 987 | 987 | actual destination. Relative to the repository root. | |
| 988 | 988 | ||
| 989 | 989 | :raise ValueError: If only one item was given | |
| 990 | - GitCommandError: If git could not handle your request""" | ||
| 990 | + :raise GitCommandError: If git could not handle your request""" | ||
| 991 | 991 | args = [] | |
| 992 | 992 | if skip_errors: | |
| 993 | 993 | args.append("-k") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,6 +82,7 @@ def _has_file_extension(path): | |||
| 82 | 82 | ||
| 83 | 83 | def run_commit_hook(name: str, index: "IndexFile", *args: str) -> None: | |
| 84 | 84 | """Run the commit hook of the given name. Silently ignores hooks that do not exist. | |
| 85 | + | ||
| 85 | 86 | :param name: name of hook, like 'pre-commit' | |
| 86 | 87 | :param index: IndexFile instance | |
| 87 | 88 | :param args: arguments passed to hook file | |
@@ -234,11 +235,13 @@ def read_cache( | |||
| 234 | 235 | stream: IO[bytes], | |
| 235 | 236 | ) -> Tuple[int, Dict[Tuple[PathLike, int], "IndexEntry"], bytes, bytes]: | |
| 236 | 237 | """Read a cache file from the given stream | |
| 238 | + | ||
| 237 | 239 | :return: tuple(version, entries_dict, extension_data, content_sha) | |
| 238 | - * version is the integer version number | ||
| 239 | - * entries dict is a dictionary which maps IndexEntry instances to a path at a stage | ||
| 240 | - * extension_data is '' or 4 bytes of type + 4 bytes of size + size bytes | ||
| 241 | - * content_sha is a 20 byte sha on all cache file contents""" | ||
| 240 | + | ||
| 241 | + * version is the integer version number | ||
| 242 | + * entries dict is a dictionary which maps IndexEntry instances to a path at a stage | ||
| 243 | + * extension_data is '' or 4 bytes of type + 4 bytes of size + size bytes | ||
| 244 | + * content_sha is a 20 byte sha on all cache file contents""" | ||
| 242 | 245 | version, num_entries = read_header(stream) | |
| 243 | 246 | count = 0 | |
| 244 | 247 | entries: Dict[Tuple[PathLike, int], "IndexEntry"] = {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -143,6 +143,7 @@ def data_stream(self) -> "OStream": | |||
| 143 | 143 | ||
| 144 | 144 | def stream_data(self, ostream: "OStream") -> "Object": | |
| 145 | 145 | """Writes our data directly to the given output stream | |
| 146 | + | ||
| 146 | 147 | :param ostream: File object compatible stream object. | |
| 147 | 148 | :return: self""" | |
| 148 | 149 | istream = self.repo.odb.stream(self.binsha) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | 38 | def tree_to_stream(entries: Sequence[EntryTup], write: Callable[["ReadableBuffer"], Union[int, None]]) -> None: | |
| 39 | 39 | """Write the give list of entries into a stream using its write method | |
| 40 | + | ||
| 40 | 41 | :param entries: **sorted** list of tuples with (binsha, mode, name) | |
| 41 | 42 | :param write: write method which takes a data string""" | |
| 42 | 43 | ord_zero = ord("0") | |
@@ -68,6 +69,7 @@ def tree_to_stream(entries: Sequence[EntryTup], write: Callable[["ReadableBuffer | |||
| 68 | 69 | ||
| 69 | 70 | def tree_entries_from_data(data: bytes) -> List[EntryTup]: | |
| 70 | 71 | """Reads the binary representation of a tree and returns tuples of Tree items | |
| 72 | + | ||
| 71 | 73 | :param data: data block with tree data (as bytes) | |
| 72 | 74 | :return: list(tuple(binsha, mode, tree_relative_path), ...)""" | |
| 73 | 75 | ord_zero = ord("0") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -128,6 +128,7 @@ def set_done(self) -> "TreeModifier": | |||
| 128 | 128 | """Call this method once you are done modifying the tree information. | |
| 129 | 129 | It may be called several times, but be aware that each call will cause | |
| 130 | 130 | a sort operation | |
| 131 | + | ||
| 131 | 132 | :return self:""" | |
| 132 | 133 | merge_sort(self._cache, git_cmp) | |
| 133 | 134 | return self | |
@@ -175,6 +176,7 @@ def add_unchecked(self, binsha: bytes, mode: int, name: str) -> None: | |||
| 175 | 176 | """Add the given item to the tree, its correctness is assumed, which | |
| 176 | 177 | puts the caller into responsibility to assure the input is correct. | |
| 177 | 178 | For more information on the parameters, see ``add`` | |
| 179 | + | ||
| 178 | 180 | :param binsha: 20 byte binary sha""" | |
| 179 | 181 | assert isinstance(binsha, bytes) and isinstance(mode, int) and isinstance(name, str) | |
| 180 | 182 | tree_cache = (binsha, mode, name) | |
@@ -259,8 +261,8 @@ def _iter_convert_to_object(self, iterable: Iterable[TreeCacheTup]) -> Iterator[ | |||
| 259 | 261 | ||
| 260 | 262 | def join(self, file: str) -> IndexObjUnion: | |
| 261 | 263 | """Find the named object in this tree's contents | |
| 262 | - :return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule`` | ||
| 263 | 264 | ||
| 265 | + :return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule`` | ||
| 264 | 266 | :raise KeyError: if given file or tree does not exist in tree""" | |
| 265 | 267 | msg = "Blob or Tree named %r not found" | |
| 266 | 268 | if "/" in file: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -140,6 +140,7 @@ def utctz_to_altz(utctz: str) -> int: | |||
| 140 | 140 | """we convert utctz to the timezone in seconds, it is the format time.altzone | |
| 141 | 141 | returns. Git stores it as UTC timezone which has the opposite sign as well, | |
| 142 | 142 | which explains the -1 * ( that was made explicit here ) | |
| 143 | + | ||
| 143 | 144 | :param utctz: git utc timezone string, i.e. +0200""" | |
| 144 | 145 | return -1 * int(float(utctz) / 100 * 3600) | |
| 145 | 146 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -253,6 +253,7 @@ def entry_at(cls, filepath: PathLike, index: int) -> "RefLogEntry": | |||
| 253 | 253 | ||
| 254 | 254 | def to_file(self, filepath: PathLike) -> None: | |
| 255 | 255 | """Write the contents of the reflog instance to a file at the given filepath. | |
| 256 | + | ||
| 256 | 257 | :param filepath: path to file, parent directories are assumed to exist""" | |
| 257 | 258 | lfd = LockedFD(filepath) | |
| 258 | 259 | assure_directory_exists(filepath, is_file=True) | |
@@ -326,6 +327,7 @@ def append_entry( | |||
| 326 | 327 | ||
| 327 | 328 | def write(self) -> "RefLog": | |
| 328 | 329 | """Write this instance's data to the file we are originating from | |
| 330 | + | ||
| 329 | 331 | :return: self""" | |
| 330 | 332 | if self._path is None: | |
| 331 | 333 | raise ValueError("Instance was not initialized with a path, use to_file(...) instead") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,8 +49,8 @@ class Reference(SymbolicReference, LazyMixin, IterableObj): | |||
| 49 | 49 | ||
| 50 | 50 | def __init__(self, repo: "Repo", path: PathLike, check_path: bool = True) -> None: | |
| 51 | 51 | """Initialize this instance | |
| 52 | - :param repo: Our parent repository | ||
| 53 | 52 | ||
| 53 | + :param repo: Our parent repository | ||
| 54 | 54 | :param path: | |
| 55 | 55 | Path relative to the .git/ directory pointing to the ref in question, i.e. | |
| 56 | 56 | refs/heads/master | |
@@ -73,6 +73,7 @@ def set_object( | |||
| 73 | 73 | logmsg: Union[str, None] = None, | |
| 74 | 74 | ) -> "Reference": | |
| 75 | 75 | """Special version which checks if the head-log needs an update as well | |
| 76 | + | ||
| 76 | 77 | :return: self""" | |
| 77 | 78 | oldbinsha = None | |
| 78 | 79 | if logmsg is not None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -756,6 +756,7 @@ def stale_refs(self) -> IterableList[Reference]: | |||
| 756 | 756 | @classmethod | |
| 757 | 757 | def create(cls, repo: "Repo", name: str, url: str, allow_unsafe_protocols: bool = False, **kwargs: Any) -> "Remote": | |
| 758 | 758 | """Create a new remote to the given repository | |
| 759 | + | ||
| 759 | 760 | :param repo: Repository instance that is to receive the new remote | |
| 760 | 761 | :param name: Desired name of the remote | |
| 761 | 762 | :param url: URL which corresponds to the remote's name | |
@@ -778,6 +779,7 @@ def add(cls, repo: "Repo", name: str, url: str, **kwargs: Any) -> "Remote": | |||
| 778 | 779 | @classmethod | |
| 779 | 780 | def remove(cls, repo: "Repo", name: str) -> str: | |
| 780 | 781 | """Remove the remote with the given name | |
| 782 | + | ||
| 781 | 783 | :return: the passed remote name to remove | |
| 782 | 784 | """ | |
| 783 | 785 | repo.git.remote("rm", name) | |
@@ -790,6 +792,7 @@ def remove(cls, repo: "Repo", name: str) -> str: | |||
| 790 | 792 | ||
| 791 | 793 | def rename(self, new_name: str) -> "Remote": | |
| 792 | 794 | """Rename self to the given new_name | |
| 795 | + | ||
| 793 | 796 | :return: self""" | |
| 794 | 797 | if self.name == new_name: | |
| 795 | 798 | return self | |
@@ -1021,11 +1024,11 @@ def pull( | |||
| 1021 | 1024 | """Pull changes from the given branch, being the same as a fetch followed | |
| 1022 | 1025 | by a merge of branch with your local branch. | |
| 1023 | 1026 | ||
| 1024 | - :param refspec: see 'fetch' method | ||
| 1025 | - :param progress: see 'push' method | ||
| 1026 | - :param kill_after_timeout: see 'fetch' method | ||
| 1027 | + :param refspec: see :meth:`fetch` method | ||
| 1028 | + :param progress: see :meth:`push` method | ||
| 1029 | + :param kill_after_timeout: see :meth:`fetch` method | ||
| 1027 | 1030 | :param kwargs: Additional arguments to be passed to git-pull | |
| 1028 | - :return: Please see 'fetch' method""" | ||
| 1031 | + :return: Please see :meth:`fetch` method""" | ||
| 1029 | 1032 | if refspec is None: | |
| 1030 | 1033 | # No argument refspec, then ensure the repo's config has a fetch refspec. | |
| 1031 | 1034 | self._assert_refspec() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments