GeezerVison is showing github.com — Run black and exclude submodule · gitpython-developers/GitPython@6035db0
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +2Lines changed: 2 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -110,6 +110,8 @@ To typecheck, run: `mypy -p git` | 110 | 110 |
| 111 | 111 | To test, run: `pytest` | 112 | 112 |
| | 113 | +For automatic code formatting run: `black git` | | 114 | + | 113 | 115 | Configuration for flake8 is in the ./.flake8 file. | 114 | 116 |
| 115 | 117 | Configurations for mypy, pytest and coverage.py are in ./pyproject.toml. | |
Collapse file Copy file name to clipboardExpand all lines: git/cmd.py +2-5Lines changed: 2 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -122,6 +122,7 @@ def handle_process_output( | 122 | 122 | To specify a timeout in seconds for the git command, after which the process | 123 | 123 | should be killed. | 124 | 124 | """ | | 125 | + | 125 | 126 | # Use 2 "pump" threads and wait for both to finish. | 126 | 127 | def pump_stream( | 127 | 128 | cmdline: List[str], | @@ -488,10 +489,7 @@ def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) -> | 488 | 489 | """ | 489 | 490 | # Options can be of the form `foo` or `--foo bar` `--foo=bar`, | 490 | 491 | # so we need to check if they start with "--foo" or if they are equal to "foo". | 491 | | - bare_unsafe_options = [ | 492 | | - option.lstrip("-") | 493 | | - for option in unsafe_options | 494 | | - ] | | 492 | + bare_unsafe_options = [option.lstrip("-") for option in unsafe_options] | 495 | 493 | for option in options: | 496 | 494 | for unsafe_option, bare_option in zip(unsafe_options, bare_unsafe_options): | 497 | 495 | if option.startswith(unsafe_option) or option == bare_option: | @@ -1194,7 +1192,6 @@ def transform_kwargs(self, split_single_char_options: bool = True, **kwargs: Any | 1194 | 1192 |
| 1195 | 1193 | @classmethod | 1196 | 1194 | def _unpack_args(cls, arg_list: Sequence[str]) -> List[str]: | 1197 | | - | 1198 | 1195 | outlist = [] | 1199 | 1196 | if isinstance(arg_list, (list, tuple)): | 1200 | 1197 | for arg in arg_list: | |
Collapse file Copy file name to clipboardExpand all lines: git/config.py +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -248,7 +248,6 @@ def items_all(self) -> List[Tuple[str, List[_T]]]: | 248 | 248 |
| 249 | 249 |
| 250 | 250 | def get_config_path(config_level: Lit_config_levels) -> str: | 251 | | - | 252 | 251 | # we do not support an absolute path of the gitconfig on windows , | 253 | 252 | # use the global config instead | 254 | 253 | if is_win and config_level == "system": | @@ -655,7 +654,7 @@ def write_section(name: str, section_dict: _OMD) -> None: | 655 | 654 |
| 656 | 655 | values: Sequence[str] # runtime only gets str in tests, but should be whatever _OMD stores | 657 | 656 | v: str | 658 | | - for (key, values) in section_dict.items_all(): | | 657 | + for key, values in section_dict.items_all(): | 659 | 658 | if key == "__name__": | 660 | 659 | continue | 661 | 660 |
| |
Collapse file Copy file name to clipboardExpand all lines: git/diff.py +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -145,7 +145,7 @@ def diff( | 145 | 145 | args.append("--full-index") # get full index paths, not only filenames | 146 | 146 |
| 147 | 147 | # remove default '-M' arg (check for renames) if user is overriding it | 148 | | - if not any(x in kwargs for x in ('find_renames', 'no_renames', 'M')): | | 148 | + if not any(x in kwargs for x in ("find_renames", "no_renames", "M")): | 149 | 149 | args.append("-M") | 150 | 150 |
| 151 | 151 | if create_patch: | @@ -338,7 +338,6 @@ def __init__( | 338 | 338 | change_type: Optional[Lit_change_type], | 339 | 339 | score: Optional[int], | 340 | 340 | ) -> None: | 341 | | - | 342 | 341 | assert a_rawpath is None or isinstance(a_rawpath, bytes) | 343 | 342 | assert b_rawpath is None or isinstance(b_rawpath, bytes) | 344 | 343 | self.a_rawpath = a_rawpath | |
Collapse file Copy file name to clipboardExpand all lines: git/exc.py -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -139,7 +139,6 @@ def __init__( | 139 | 139 | valid_files: Sequence[PathLike], | 140 | 140 | failed_reasons: List[str], | 141 | 141 | ) -> None: | 142 | | - | 143 | 142 | Exception.__init__(self, message) | 144 | 143 | self.failed_files = failed_files | 145 | 144 | self.failed_reasons = failed_reasons | @@ -170,7 +169,6 @@ def __init__( | 170 | 169 | stderr: Union[bytes, str, None] = None, | 171 | 170 | stdout: Union[bytes, str, None] = None, | 172 | 171 | ) -> None: | 173 | | - | 174 | 172 | super(HookExecutionError, self).__init__(command, status, stderr, stdout) | 175 | 173 | self._msg = "Hook('%s') failed%s" | 176 | 174 |
| |
Collapse file Copy file name to clipboardExpand all lines: git/index/fun.py -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -394,7 +394,6 @@ def aggressive_tree_merge(odb: "GitCmdObjectDB", tree_shas: Sequence[bytes]) -> | 394 | 394 | out.append(_tree_entry_to_baseindexentry(theirs, 0)) | 395 | 395 | # END handle modification | 396 | 396 | else: | 397 | | - | 398 | 397 | if ours[0] != base[0] or ours[1] != base[1]: | 399 | 398 | # they deleted it, we changed it, conflict | 400 | 399 | out.append(_tree_entry_to_baseindexentry(base, 1)) | |
Collapse file Copy file name to clipboardExpand all lines: git/objects/commit.py +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -345,9 +345,7 @@ def trailers(self) -> Dict[str, str]: | 345 | 345 | Dictionary containing whitespace stripped trailer information. | 346 | 346 | Only contains the latest instance of each trailer key. | 347 | 347 | """ | 348 | | - return { | 349 | | - k: v[0] for k, v in self.trailers_dict.items() | 350 | | - } | | 348 | + return {k: v[0] for k, v in self.trailers_dict.items()} | 351 | 349 |
| 352 | 350 | @property | 353 | 351 | def trailers_list(self) -> List[Tuple[str, str]]: | |
Collapse file Copy file name to clipboardExpand all lines: git/objects/fun.py -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -190,7 +190,6 @@ def traverse_trees_recursive( | 190 | 190 | # is a tree. If the match is a non-tree item, put it into the result. | 191 | 191 | # Processed items will be set None | 192 | 192 | for ti, tree_data in enumerate(trees_data): | 193 | | - | 194 | 193 | for ii, item in enumerate(tree_data): | 195 | 194 | if not item: | 196 | 195 | continue | |
Collapse file Copy file name to clipboardExpand all lines: git/objects/util.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -143,7 +143,7 @@ def utctz_to_altz(utctz: str) -> int: | 143 | 143 | :param utctz: git utc timezone string, i.e. +0200 | 144 | 144 | """ | 145 | 145 | int_utctz = int(utctz) | 146 | | - seconds = ((abs(int_utctz) // 100) * 3600 + (abs(int_utctz) % 100) * 60) | | 146 | + seconds = (abs(int_utctz) // 100) * 3600 + (abs(int_utctz) % 100) * 60 | 147 | 147 | return seconds if int_utctz < 0 else -seconds | 148 | 148 |
| 149 | 149 |
| |
Collapse file Copy file name to clipboardExpand all lines: git/remote.py -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -826,7 +826,6 @@ def _get_fetch_info_from_stderr( | 826 | 826 | progress: Union[Callable[..., Any], RemoteProgress, None], | 827 | 827 | kill_after_timeout: Union[None, float] = None, | 828 | 828 | ) -> IterableList["FetchInfo"]: | 829 | | - | 830 | 829 | progress = to_progress_instance(progress) | 831 | 830 |
| 832 | 831 | # skip first line as it is some remote info we are not interested in | |
|