| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 36a3b76 commit a47e46d
24 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -718,7 +718,7 @@ def __init__(self, working_dir: Union[None, PathLike] = None): | |||
| 718 | 718 | It is meant to be the working tree directory if available, or the | |
| 719 | 719 | ``.git`` directory in case of bare repositories. | |
| 720 | 720 | """ | |
| 721 | - super(Git, self).__init__() | ||
| 721 | + super().__init__() | ||
| 722 | 722 | self._working_dir = expand_path(working_dir) | |
| 723 | 723 | self._git_options: Union[List[str], Tuple[str, ...]] = () | |
| 724 | 724 | self._persistent_git_options: List[str] = [] | |
@@ -765,7 +765,7 @@ def _set_cache_(self, attr: str) -> None: | |||
| 765 | 765 | tuple(int(n) for n in version_numbers.split(".")[:4] if n.isdigit()), | |
| 766 | 766 | ) | |
| 767 | 767 | else: | |
| 768 | - super(Git, self)._set_cache_(attr) | ||
| 768 | + super()._set_cache_(attr) | ||
| 769 | 769 | # END handle version info | |
| 770 | 770 | ||
| 771 | 771 | @property | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,7 +107,7 @@ def __new__(cls, name: str, bases: Tuple, clsdict: Dict[str, Any]) -> "MetaParse | |||
| 107 | 107 | # END for each base | |
| 108 | 108 | # END if mutating methods configuration is set | |
| 109 | 109 | ||
| 110 | - new_type = super(MetaParserBuilder, cls).__new__(cls, name, bases, clsdict) | ||
| 110 | + new_type = super().__new__(cls, name, bases, clsdict) | ||
| 111 | 111 | return new_type | |
| 112 | 112 | ||
| 113 | 113 | ||
@@ -178,7 +178,7 @@ def __del__(self) -> None: | |||
| 178 | 178 | def __getattr__(self, attr: str) -> Any: | |
| 179 | 179 | if attr in self._valid_attrs_: | |
| 180 | 180 | return lambda *args, **kwargs: self._call_config(attr, *args, **kwargs) | |
| 181 | - return super(SectionConstraint, self).__getattribute__(attr) | ||
| 181 | + return super().__getattribute__(attr) | ||
| 182 | 182 | ||
| 183 | 183 | def _call_config(self, method: str, *args: Any, **kwargs: Any) -> Any: | |
| 184 | 184 | """Call the configuration at the given method which must take a section name | |
@@ -207,36 +207,36 @@ class _OMD(OrderedDict_OMD): | |||
| 207 | 207 | """Ordered multi-dict.""" | |
| 208 | 208 | ||
| 209 | 209 | def __setitem__(self, key: str, value: _T) -> None: | |
| 210 | - super(_OMD, self).__setitem__(key, [value]) | ||
| 210 | + super().__setitem__(key, [value]) | ||
| 211 | 211 | ||
| 212 | 212 | def add(self, key: str, value: Any) -> None: | |
| 213 | 213 | if key not in self: | |
| 214 | - super(_OMD, self).__setitem__(key, [value]) | ||
| 214 | + super().__setitem__(key, [value]) | ||
| 215 | 215 | return None | |
| 216 | - super(_OMD, self).__getitem__(key).append(value) | ||
| 216 | + super().__getitem__(key).append(value) | ||
| 217 | 217 | ||
| 218 | 218 | def setall(self, key: str, values: List[_T]) -> None: | |
| 219 | - super(_OMD, self).__setitem__(key, values) | ||
| 219 | + super().__setitem__(key, values) | ||
| 220 | 220 | ||
| 221 | 221 | def __getitem__(self, key: str) -> Any: | |
| 222 | - return super(_OMD, self).__getitem__(key)[-1] | ||
| 222 | + return super().__getitem__(key)[-1] | ||
| 223 | 223 | ||
| 224 | 224 | def getlast(self, key: str) -> Any: | |
| 225 | - return super(_OMD, self).__getitem__(key)[-1] | ||
| 225 | + return super().__getitem__(key)[-1] | ||
| 226 | 226 | ||
| 227 | 227 | def setlast(self, key: str, value: Any) -> None: | |
| 228 | 228 | if key not in self: | |
| 229 | - super(_OMD, self).__setitem__(key, [value]) | ||
| 229 | + super().__setitem__(key, [value]) | ||
| 230 | 230 | return | |
| 231 | 231 | ||
| 232 | - prior = super(_OMD, self).__getitem__(key) | ||
| 232 | + prior = super().__getitem__(key) | ||
| 233 | 233 | prior[-1] = value | |
| 234 | 234 | ||
| 235 | 235 | def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]: | |
| 236 | - return super(_OMD, self).get(key, [default])[-1] | ||
| 236 | + return super().get(key, [default])[-1] | ||
| 237 | 237 | ||
| 238 | 238 | def getall(self, key: str) -> List[_T]: | |
| 239 | - return super(_OMD, self).__getitem__(key) | ||
| 239 | + return super().__getitem__(key) | ||
| 240 | 240 | ||
| 241 | 241 | def items(self) -> List[Tuple[str, _T]]: # type: ignore[override] | |
| 242 | 242 | """List of (key, last value for key).""" | |
@@ -680,7 +680,7 @@ def write_section(name: str, section_dict: _OMD) -> None: | |||
| 680 | 680 | ||
| 681 | 681 | def items(self, section_name: str) -> List[Tuple[str, str]]: # type: ignore[override] | |
| 682 | 682 | """:return: list((option, value), ...) pairs of all items in the given section""" | |
| 683 | - return [(k, v) for k, v in super(GitConfigParser, self).items(section_name) if k != "__name__"] | ||
| 683 | + return [(k, v) for k, v in super().items(section_name) if k != "__name__"] | ||
| 684 | 684 | ||
| 685 | 685 | def items_all(self, section_name: str) -> List[Tuple[str, List[str]]]: | |
| 686 | 686 | """:return: list((option, [values...]), ...) pairs of all items in the given section""" | |
@@ -748,7 +748,7 @@ def _assure_writable(self, method_name: str) -> None: | |||
| 748 | 748 | ||
| 749 | 749 | def add_section(self, section: str) -> None: | |
| 750 | 750 | """Assures added options will stay in order""" | |
| 751 | - return super(GitConfigParser, self).add_section(section) | ||
| 751 | + return super().add_section(section) | ||
| 752 | 752 | ||
| 753 | 753 | @property | |
| 754 | 754 | def read_only(self) -> bool: | |
@@ -899,7 +899,7 @@ def rename_section(self, section: str, new_name: str) -> "GitConfigParser": | |||
| 899 | 899 | if self.has_section(new_name): | |
| 900 | 900 | raise ValueError("Destination section '%s' already exists" % new_name) | |
| 901 | 901 | ||
| 902 | - super(GitConfigParser, self).add_section(new_name) | ||
| 902 | + super().add_section(new_name) | ||
| 903 | 903 | new_section = self._sections[new_name] | |
| 904 | 904 | for k, vs in self.items_all(section): | |
| 905 | 905 | new_section.setall(k, vs) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ class GitCmdObjectDB(LooseObjectDB): | |||
| 34 | 34 | ||
| 35 | 35 | def __init__(self, root_path: PathLike, git: "Git") -> None: | |
| 36 | 36 | """Initialize this instance with the root and a git command.""" | |
| 37 | - super(GitCmdObjectDB, self).__init__(root_path) | ||
| 37 | + super().__init__(root_path) | ||
| 38 | 38 | self._git = git | |
| 39 | 39 | ||
| 40 | 40 | def info(self, binsha: bytes) -> OInfo: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,7 +137,7 @@ class GitCommandNotFound(CommandError): | |||
| 137 | 137 | the GIT_PYTHON_GIT_EXECUTABLE environment variable.""" | |
| 138 | 138 | ||
| 139 | 139 | def __init__(self, command: Union[List[str], Tuple[str], str], cause: Union[str, Exception]) -> None: | |
| 140 | - super(GitCommandNotFound, self).__init__(command, cause) | ||
| 140 | + super().__init__(command, cause) | ||
| 141 | 141 | self._msg = "Cmd('%s') not found%s" | |
| 142 | 142 | ||
| 143 | 143 | ||
@@ -151,7 +151,7 @@ def __init__( | |||
| 151 | 151 | stderr: Union[bytes, str, None] = None, | |
| 152 | 152 | stdout: Union[bytes, str, None] = None, | |
| 153 | 153 | ) -> None: | |
| 154 | - super(GitCommandError, self).__init__(command, status, stderr, stdout) | ||
| 154 | + super().__init__(command, status, stderr, stdout) | ||
| 155 | 155 | ||
| 156 | 156 | ||
| 157 | 157 | class CheckoutError(GitError): | |
@@ -207,7 +207,7 @@ def __init__( | |||
| 207 | 207 | stderr: Union[bytes, str, None] = None, | |
| 208 | 208 | stdout: Union[bytes, str, None] = None, | |
| 209 | 209 | ) -> None: | |
| 210 | - super(HookExecutionError, self).__init__(command, status, stderr, stdout) | ||
| 210 | + super().__init__(command, status, stderr, stdout) | ||
| 211 | 211 | self._msg = "Hook('%s') failed%s" | |
| 212 | 212 | ||
| 213 | 213 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -153,7 +153,7 @@ def _set_cache_(self, attr: str) -> None: | |||
| 153 | 153 | ||
| 154 | 154 | self._deserialize(stream) | |
| 155 | 155 | else: | |
| 156 | - super(IndexFile, self)._set_cache_(attr) | ||
| 156 | + super()._set_cache_(attr) | ||
| 157 | 157 | ||
| 158 | 158 | def _index_path(self) -> PathLike: | |
| 159 | 159 | if self.repo.git_dir: | |
@@ -1425,4 +1425,4 @@ def diff( | |||
| 1425 | 1425 | raise ValueError("other must be None, Diffable.Index, a Tree or Commit, was %r" % other) | |
| 1426 | 1426 | ||
| 1427 | 1427 | # Diff against working copy - can be handled by superclass natively. | |
| 1428 | - return super(IndexFile, self).diff(other, paths, create_patch, **kwargs) | ||
| 1428 | + return super().diff(other, paths, create_patch, **kwargs) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,7 +62,7 @@ def __init__(self, repo: "Repo", binsha: bytes): | |||
| 62 | 62 | ||
| 63 | 63 | :param binsha: 20 byte SHA1 | |
| 64 | 64 | """ | |
| 65 | - super(Object, self).__init__() | ||
| 65 | + super().__init__() | ||
| 66 | 66 | self.repo = repo | |
| 67 | 67 | self.binsha = binsha | |
| 68 | 68 | assert len(binsha) == 20, "Require 20 byte binary sha, got %r, len = %i" % ( | |
@@ -108,7 +108,7 @@ def _set_cache_(self, attr: str) -> None: | |||
| 108 | 108 | self.size = oinfo.size # type: int | |
| 109 | 109 | # assert oinfo.type == self.type, _assertion_msg_format % (self.binsha, oinfo.type, self.type) | |
| 110 | 110 | else: | |
| 111 | - super(Object, self)._set_cache_(attr) | ||
| 111 | + super()._set_cache_(attr) | ||
| 112 | 112 | ||
| 113 | 113 | def __eq__(self, other: Any) -> bool: | |
| 114 | 114 | """:return: True if the objects have the same SHA1""" | |
@@ -190,7 +190,7 @@ def __init__( | |||
| 190 | 190 | Path may not be set if the index object has been created directly, as it | |
| 191 | 191 | cannot be retrieved without knowing the parent tree. | |
| 192 | 192 | """ | |
| 193 | - super(IndexObject, self).__init__(repo, binsha) | ||
| 193 | + super().__init__(repo, binsha) | ||
| 194 | 194 | if mode is not None: | |
| 195 | 195 | self.mode = mode | |
| 196 | 196 | if path is not None: | |
@@ -212,7 +212,7 @@ def _set_cache_(self, attr: str) -> None: | |||
| 212 | 212 | % (attr, type(self).__name__) | |
| 213 | 213 | ) | |
| 214 | 214 | else: | |
| 215 | - super(IndexObject, self)._set_cache_(attr) | ||
| 215 | + super()._set_cache_(attr) | ||
| 216 | 216 | # END handle slot attribute | |
| 217 | 217 | ||
| 218 | 218 | @property | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -146,7 +146,7 @@ def __init__( | |||
| 146 | 146 | as what time.altzone returns. The sign is inverted compared to git's | |
| 147 | 147 | UTC timezone. | |
| 148 | 148 | """ | |
| 149 | - super(Commit, self).__init__(repo, binsha) | ||
| 149 | + super().__init__(repo, binsha) | ||
| 150 | 150 | self.binsha = binsha | |
| 151 | 151 | if tree is not None: | |
| 152 | 152 | assert isinstance(tree, Tree), "Tree needs to be a Tree instance, was %s" % type(tree) | |
@@ -218,7 +218,7 @@ def _set_cache_(self, attr: str) -> None: | |||
| 218 | 218 | _binsha, _typename, self.size, stream = self.repo.odb.stream(self.binsha) | |
| 219 | 219 | self._deserialize(BytesIO(stream.read())) | |
| 220 | 220 | else: | |
| 221 | - super(Commit, self)._set_cache_(attr) | ||
| 221 | + super()._set_cache_(attr) | ||
| 222 | 222 | # END handle attrs | |
| 223 | 223 | ||
| 224 | 224 | @property | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,7 +124,7 @@ def __init__( | |||
| 124 | 124 | :param branch_path: Full (relative) path to ref to checkout when cloning the | |
| 125 | 125 | remote repository. | |
| 126 | 126 | """ | |
| 127 | - super(Submodule, self).__init__(repo, binsha, mode, path) | ||
| 127 | + super().__init__(repo, binsha, mode, path) | ||
| 128 | 128 | self.size = 0 | |
| 129 | 129 | self._parent_commit = parent_commit | |
| 130 | 130 | if url is not None: | |
@@ -154,7 +154,7 @@ def _set_cache_(self, attr: str) -> None: | |||
| 154 | 154 | elif attr == "_name": | |
| 155 | 155 | raise AttributeError("Cannot retrieve the name of a submodule if it was not set initially") | |
| 156 | 156 | else: | |
| 157 | - super(Submodule, self)._set_cache_(attr) | ||
| 157 | + super()._set_cache_(attr) | ||
| 158 | 158 | # END handle attribute name | |
| 159 | 159 | ||
| 160 | 160 | @classmethod | |
@@ -174,7 +174,7 @@ def __eq__(self, other: Any) -> bool: | |||
| 174 | 174 | """Compare with another submodule.""" | |
| 175 | 175 | # We may only compare by name as this should be the ID they are hashed with. | |
| 176 | 176 | # Otherwise this type wouldn't be hashable. | |
| 177 | - # return self.path == other.path and self.url == other.url and super(Submodule, self).__eq__(other) | ||
| 177 | + # return self.path == other.path and self.url == other.url and super().__eq__(other) | ||
| 178 | 178 | return self._name == other._name | |
| 179 | 179 | ||
| 180 | 180 | def __ne__(self, other: object) -> bool: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,7 @@ class RootModule(Submodule): | |||
| 55 | 55 | ||
| 56 | 56 | def __init__(self, repo: "Repo"): | |
| 57 | 57 | # repo, binsha, mode=None, path=None, name = None, parent_commit=None, url=None, ref=None) | |
| 58 | - super(RootModule, self).__init__( | ||
| 58 | + super().__init__( | ||
| 59 | 59 | repo, | |
| 60 | 60 | binsha=self.NULL_BIN_SHA, | |
| 61 | 61 | mode=self.k_default_mode, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,7 +79,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: | |||
| 79 | 79 | self._smref: Union["ReferenceType[Submodule]", None] = None | |
| 80 | 80 | self._index = None | |
| 81 | 81 | self._auto_write = True | |
| 82 | - super(SubmoduleConfigParser, self).__init__(*args, **kwargs) | ||
| 82 | + super().__init__(*args, **kwargs) | ||
| 83 | 83 | ||
| 84 | 84 | # { Interface | |
| 85 | 85 | def set_submodule(self, submodule: "Submodule") -> None: | |
@@ -107,7 +107,7 @@ def flush_to_index(self) -> None: | |||
| 107 | 107 | ||
| 108 | 108 | # { Overridden Methods | |
| 109 | 109 | def write(self) -> None: # type: ignore[override] | |
| 110 | - rval: None = super(SubmoduleConfigParser, self).write() | ||
| 110 | + rval: None = super().write() | ||
| 111 | 111 | self.flush_to_index() | |
| 112 | 112 | return rval | |
| 113 | 113 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments