Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Drop 3.6, increase type strictness#1311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Yobmod merged 36 commits intogitpython-developers:mainfromYobmod:main
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
36 commits
Select commitHold shift + click to select a range
39d37d5
replace some TBDs wiht runtime types
YobmodJul 31, 2021
c878771
replace more TBDs wiht runtime types
YobmodJul 31, 2021
009017e
Merge branch 'gitpython-developers:main' into main
YobmodAug 2, 2021
2163322
increase mypy strictness (warn unused ignored)
YobmodAug 2, 2021
0525c17
Merge branch 'main' of https://github.com/Yobmod/GitPython
YobmodAug 2, 2021
91fce33
increase mypy strictness (warn unused ignored and warn unreachable)
YobmodAug 2, 2021
15ace87
rmv 3.6 from CI matrix
YobmodAug 2, 2021
bef2182
rmv 3.6 from setup.py
YobmodAug 2, 2021
270c3d7
rmv 3.6 README
YobmodAug 2, 2021
c3f3501
Add __future__.annotations to cmd.py
YobmodAug 2, 2021
829142d
Add __future__.annotations to cmd.py2
YobmodAug 2, 2021
13e0730
Fix parse_date typing
YobmodAug 2, 2021
730f119
Fix parse_date typing 2
YobmodAug 2, 2021
2fe13ca
Fix parse_date typing 3
YobmodAug 2, 2021
024b696
Fix parse_date typing 4
YobmodAug 2, 2021
e2f8367
Fix parse_date typing 5
YobmodAug 2, 2021
d30bc07
Fix parse_date typing 6
YobmodAug 2, 2021
6470ad4
Fix parse_date typing 7
YobmodAug 2, 2021
481f672
Add __future__.annotations to repo/base.py
YobmodAug 2, 2021
9de7310
Minor type fixes
YobmodAug 2, 2021
5647d58
Merge branch 'gitpython-developers:main' into main
YobmodAug 2, 2021
f34a39f
Test new union syntax (Pep604)
YobmodAug 2, 2021
3b53d28
Merge branch 'main' of https://github.com/Yobmod/GitPython
YobmodAug 2, 2021
4dd06c3
Test trailing comma in args (>py3.6?)
YobmodAug 2, 2021
94ae0c5
Test Dataclass in repo.base.blame()
YobmodAug 2, 2021
a3f5b13
Test Dataclass in repo.base.blame() 2
YobmodAug 2, 2021
a2a36e0
Test Dataclass in repo.base.blame() 3
YobmodAug 2, 2021
ed137cb
Test TypedDict in repo.base.blame() 2
YobmodAug 2, 2021
e4761ff
Test TypedDict in repo.base.blame() 1
YobmodAug 2, 2021
1aaa704
Test Dataclass in repo.base.blame() 4
YobmodAug 2, 2021
bc9bcf5
Test Dataclass in repo.base.blame() 5
YobmodAug 2, 2021
ad417ba
Test Dataclass in repo.base.blame() 6
YobmodAug 2, 2021
ecb1f79
Choose TypedDict!
YobmodAug 2, 2021
5aa8c34
Improve type of repo.blame_incremental()
YobmodAug 2, 2021
8b8aa16
Improve type of repo.currently_rebasing_on()
YobmodAug 2, 2021
84232f7
Add Typing :: Typed to setup.py
YobmodAug 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion.github/workflows/pythonpackage.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10.0-beta.4"]
python-version: [3.7, 3.8, 3.9, "3.10.0-beta.4"]

steps:
- uses: actions/checkout@v2
Expand Down
87 changes: 42 additions & 45 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,32 +24,30 @@ or low-level like git-plumbing.

It provides abstractions of git objects for easy access of repository data, and additionally
allows you to access the git repository more directly using either a pure python implementation,
or the faster, but more resource intensive*git command* implementation.
or the faster, but more resource intensive_git command_ implementation.

The object database implementation is optimized for handling large quantities of objects and large datasets,
which is achieved by using low-level structures and data streaming.


### DEVELOPMENT STATUS

This project is in **maintenance mode**, which means that

* …there will be no feature development, unless these are contributed
* …there will be no bug fixes, unless they are relevant to the safety of users, or contributed
* …issues will be responded to with waiting times of up to a month
- …there will be no feature development, unless these are contributed
- …there will be no bug fixes, unless they are relevant to the safety of users, or contributed
- …issues will be responded to with waiting times of up to a month

The project is open to contributions of all kinds, as well as new maintainers.


### REQUIREMENTS

GitPython needs the `git` executable to be installed on the system and available
in your `PATH` for most operations.
If it is not in your `PATH`, you can help GitPython find it by setting
the `GIT_PYTHON_GIT_EXECUTABLE=<path/to/git>` environment variable.

* Git (1.7.x or newer)
* Python >= 3.6
- Git (1.7.x or newer)
- Python >= 3.7

The list of dependencies are listed in `./requirements.txt` and `./test-requirements.txt`.
The installer takes care of installing them for you.
Expand DownExpand Up@@ -98,57 +96,56 @@ See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).

### RUNNING TESTS

*Important*: Right after cloning this repository, please be sure to have executed
_Important_: Right after cloning this repository, please be sure to have executed
the `./init-tests-after-clone.sh` script in the repository root. Otherwise
you will encounter test failures.

On*Windows*, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
On_Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
with MINGW's.

Ensure testing libraries are installed.
In the root directory, run: `pip install -r test-requirements.txt`
Ensure testing libraries are installed.
In the root directory, run: `pip install -r test-requirements.txt`

To lint, run: `flake8`

To typecheck, run: `mypy -p git`
To typecheck, run: `mypy -p git`

To test, run: `pytest`

Configuration for flake8 is in the ./.flake8 file.

Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.

The same linting and testing will also be performed against different supported python versions
The same linting and testing will also be performed against different supported python versions
upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).


### Contributions

Please have a look at the [contributions file][contributing].

### INFRASTRUCTURE

* [User Documentation](http://gitpython.readthedocs.org)
* [Questions and Answers](http://stackexchange.com/filters/167317/gitpython)
* Please post on stackoverflow and use the `gitpython` tag
* [Issue Tracker](https://github.com/gitpython-developers/GitPython/issues)
* Post reproducible bugs and feature requests as a new issue.
- [User Documentation](http://gitpython.readthedocs.org)
- [Questions and Answers](http://stackexchange.com/filters/167317/gitpython)
- Please post on stackoverflow and use the `gitpython` tag
- [Issue Tracker](https://github.com/gitpython-developers/GitPython/issues)
- Post reproducible bugs and feature requests as a new issue.
Please be sure to provide the following information if posting bugs:
* GitPython version (e.g. `import git; git.__version__`)
* Python version (e.g. `python --version`)
* The encountered stack-trace, if applicable
* Enough information to allow reproducing the issue
- GitPython version (e.g. `import git; git.__version__`)
- Python version (e.g. `python --version`)
- The encountered stack-trace, if applicable
- Enough information to allow reproducing the issue

### How to make a new release

* Update/verify the **version** in the `VERSION` file
* Update/verify that the `doc/source/changes.rst` changelog file was updated
* Commit everything
* Run `git tag -s <version>` to tag the version in Git
* Run `make release`
* Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
* set the upcoming version in the `VERSION` file, usually be
- Update/verify the **version** in the `VERSION` file
- Update/verify that the `doc/source/changes.rst` changelog file was updated
- Commit everything
- Run `git tag -s <version>` to tag the version in Git
- Run `make release`
- Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
- set the upcoming version in the `VERSION` file, usually be
incrementing the patch level, and possibly by appending `-dev`. Probably you
want to `git push` once more.

Expand DownExpand Up@@ -200,22 +197,22 @@ gpg --edit-key 4C08421980C9

### Projects using GitPython

* [PyDriller](https://github.com/ishepard/pydriller)
* [Kivy Designer](https://github.com/kivy/kivy-designer)
* [Prowl](https://github.com/nettitude/Prowl)
* [Python Taint](https://github.com/python-security/pyt)
* [Buster](https://github.com/axitkhurana/buster)
* [git-ftp](https://github.com/ezyang/git-ftp)
* [Git-Pandas](https://github.com/wdm0006/git-pandas)
* [PyGitUp](https://github.com/msiemens/PyGitUp)
* [PyJFuzz](https://github.com/mseclab/PyJFuzz)
* [Loki](https://github.com/Neo23x0/Loki)
* [Omniwallet](https://github.com/OmniLayer/omniwallet)
* [GitViper](https://github.com/BeayemX/GitViper)
* [Git Gud](https://github.com/bthayer2365/git-gud)
- [PyDriller](https://github.com/ishepard/pydriller)
- [Kivy Designer](https://github.com/kivy/kivy-designer)
- [Prowl](https://github.com/nettitude/Prowl)
- [Python Taint](https://github.com/python-security/pyt)
- [Buster](https://github.com/axitkhurana/buster)
- [git-ftp](https://github.com/ezyang/git-ftp)
- [Git-Pandas](https://github.com/wdm0006/git-pandas)
- [PyGitUp](https://github.com/msiemens/PyGitUp)
- [PyJFuzz](https://github.com/mseclab/PyJFuzz)
- [Loki](https://github.com/Neo23x0/Loki)
- [Omniwallet](https://github.com/OmniLayer/omniwallet)
- [GitViper](https://github.com/BeayemX/GitViper)
- [Git Gud](https://github.com/bthayer2365/git-gud)

### LICENSE

New BSD License.See the LICENSE file.
New BSD License. See the LICENSE file.

[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/CONTRIBUTING.md
6 changes: 4 additions & 2 deletionsdoc/source/intro.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,15 +13,17 @@ The object database implementation is optimized for handling large quantities of
Requirements
============

* `Python`_ >= 3.6
* `Python`_ >= 3.7
* `Git`_ 1.7.0 or newer
It should also work with older versions, but it may be that some operations
involving remotes will not work as expected.
* `GitDB`_ - a pure python git database implementation
* `typing_extensions`_ >= 3.7.3.4 (if python < 3.10)

.. _Python: https://www.python.org
.. _Git: https://git-scm.com/
.. _GitDB: https://pypi.python.org/pypi/gitdb
.. _typing_extensions: https://pypi.org/project/typing-extensions/

Installing GitPython
====================
Expand DownExpand Up@@ -60,7 +62,7 @@ Leakage of System Resources
---------------------------

GitPython is not suited for long-running processes (like daemons) as it tends to
leak system resources. It was written in a time where destructors (as implemented
leak system resources. It was written in a time where destructors (as implemented
in the `__del__` method) still ran deterministically.

In case you still want to use it in such a context, you will want to search the
Expand Down
37 changes: 17 additions & 20 deletionsgit/cmd.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@
from typing import (Any, AnyStr, BinaryIO, Callable, Dict, IO, Iterator, List, Mapping,
Sequence, TYPE_CHECKING, TextIO, Tuple, Union, cast, overload)

from git.types import PathLike, Literal
from git.types import PathLike, Literal, TBD

if TYPE_CHECKING:
from git.repo.base import Repo
Expand All@@ -68,7 +68,7 @@
# Documentation
## @{

def handle_process_output(process: subprocess.Popen,
def handle_process_output(process:Union[subprocess.Popen, 'Git.AutoInterrupt'],
stdout_handler: Union[None,
Callable[[AnyStr], None],
Callable[[List[AnyStr]], None],
Expand All@@ -77,7 +77,7 @@ def handle_process_output(process: subprocess.Popen,
Callable[[AnyStr], None],
Callable[[List[AnyStr]], None]],
finalizer: Union[None,
Callable[[subprocess.Popen], None]] = None,
Callable[[Union[subprocess.Popen, 'Git.AutoInterrupt']], None]] = None,
decode_streams: bool = True) -> None:
"""Registers for notifications to learn that process output is ready to read, and dispatches lines to
the respective line handlers.
Expand DownExpand Up@@ -165,7 +165,7 @@ def dict_to_slots_and__excluded_are_none(self: object, d: Mapping[str, Any], exc
## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards,
# see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal
PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP # type: ignore[attr-defined]
if is_win else 0)
if is_win else 0) # mypy error if not windows


class Git(LazyMixin):
Expand DownExpand Up@@ -421,27 +421,27 @@ def __getattr__(self, attr: str) -> Any:
return getattr(self.proc, attr)

# TODO: Bad choice to mimic `proc.wait()` but with different args.
def wait(self, stderr: Union[None, bytes] = b'') -> int:
def wait(self, stderr: Union[None,str,bytes] = b'') -> int:
"""Wait for the process and return its status code.

:param stderr: Previously read value of stderr, in case stderr is already closed.
:warn: may deadlock if output or error pipes are used and not handled separately.
:raise GitCommandError: if the return status is not 0"""
if stderr is None:
stderr = b''
stderr = force_bytes(data=stderr, encoding='utf-8')
stderr_b = b''
stderr_b = force_bytes(data=stderr, encoding='utf-8')

if self.proc is not None:
status = self.proc.wait()

def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> bytes:
if stream:
try:
returnstderr + force_bytes(stream.read())
returnstderr_b + force_bytes(stream.read())
except ValueError:
returnstderr or b''
returnstderr_b or b''
else:
returnstderr or b''
returnstderr_b or b''

if status != 0:
errstr = read_all_from_possibly_closed_stream(self.proc.stderr)
Expand DownExpand Up@@ -575,8 +575,8 @@ def __init__(self, working_dir: Union[None, PathLike] = None):
self._environment: Dict[str, str] = {}

# cached command slots
self.cat_file_header = None
self.cat_file_all = None
self.cat_file_header: Union[None, TBD] = None
self.cat_file_all: Union[None, TBD] = None

def __getattr__(self, name: str) -> Any:
"""A convenience method as it allows to call the command as if it was
Expand DownExpand Up@@ -1012,17 +1012,14 @@ def transform_kwargs(self, split_single_char_options: bool = True, **kwargs: Any

@classmethod
def __unpack_args(cls, arg_list: Sequence[str]) -> List[str]:
if not isinstance(arg_list, (list, tuple)):
return [str(arg_list)]

outlist = []
for arg in arg_list:
if isinstance(arg_list, (list, tuple)):
if isinstance(arg_list, (list, tuple)):
for arg in arg_list:
outlist.extend(cls.__unpack_args(arg))
# END recursion
else:
outlist.append(str(arg))
# END for each arg
else:
outlist.append(str(arg_list))

return outlist

def __call__(self, **kwargs: Any) -> 'Git':
Expand Down
18 changes: 0 additions & 18 deletionsgit/compat.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,8 +29,6 @@
Union,
overload,
)
from git.types import TBD

# ---------------------------------------------------------------------------


Expand DownExpand Up@@ -97,19 +95,3 @@ def win_encode(s: Optional[AnyStr]) -> Optional[bytes]:
elif s is not None:
raise TypeError('Expected bytes or text, but got %r' % (s,))
return None


# type: ignore ## mypy cannot understand dynamic class creation
def with_metaclass(meta: Type[Any], *bases: Any) -> TBD:
"""copied from https://github.com/Byron/bcore/blob/master/src/python/butility/future.py#L15"""

class metaclass(meta): # type: ignore
__call__ = type.__call__
__init__ = type.__init__ # type: ignore

def __new__(cls, name: str, nbases: Optional[Tuple[int, ...]], d: Dict[str, Any]) -> TBD:
if nbases is None:
return type.__new__(cls, name, (), d)
return meta(name, bases, d)

return metaclass(meta.__name__ + 'Helper', None, {}) # type: ignore
Loading

[8]ページ先頭

©2009-2025 Movatter.jp