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

Commitf6aa8d1

Browse files
committed
initial set of adjustments to make (most) imports work.
More to come, especially when it's about strings
1 parent3936084 commitf6aa8d1

37 files changed

+136
-114
lines changed

‎README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ In short, I want to make a new release of 0.3 with all contributions and fixes i
8383

8484
The goals I have set for myself, in order, are as follows, all on branch 0.3.
8585

86-
* bring the test suite back online to work with the most commonly used git version
87-
* merge all open pull requests, may there be a test-case or not, back. If something breaks, fix it if possible or let the contributor know
88-
* conform git-python's structure and toolchain to the one used in my[other OSS projects](https://github.com/Byron/bcore)
89-
* evaluate all open issues and close them if possible
9086
* evaluate python 3.3 compatibility and establish it if possible
9187

9288
While that is happening, I will try hard to foster community around the project. This means being more responsive on the mailing list and in issues, as well as setting up clear guide lines about the[contribution](http://rfc.zeromq.org/spec:22) and maintenance workflow.

‎doc/source/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changelog
66
=====
77
* When fetching, pulling or pushing, and an error occours, it will not be reported on stdout anymore. However, if there is a fatal error, it will still result in a GitCommandError to be thrown. This goes hand in hand with improved fetch result parsing.
88
* Code Cleanup (in preparation for python 3 support)
9+
910
* Applied autopep8 and cleaned up code
1011
* Using python logging module instead of print statments to signal certain kinds of errors
1112

‎git/cmd.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77
importos
88
importsys
99
importlogging
10-
fromutilimport (
11-
LazyMixin,
12-
stream_copy
13-
)
14-
fromexcimportGitCommandError
15-
1610
fromsubprocessimport (
1711
call,
1812
Popen,
1913
PIPE
2014
)
2115

16+
17+
from .utilimport (
18+
LazyMixin,
19+
stream_copy
20+
)
21+
from .excimportGitCommandError
22+
23+
2224
execute_kwargs= ('istream','with_keep_cwd','with_extended_output',
2325
'with_exceptions','as_process',
2426
'output_stream')

‎git/compat.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#-*-coding:utf-8-*-
2+
# config.py
3+
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
4+
#
5+
# This module is part of GitPython and is released under
6+
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
7+
"""utilities to help provide compatibility with python 3"""
8+
9+
fromgitdb.utils.compatimport (# noqa
10+
PY3,
11+
xrange,
12+
MAXSIZE,
13+
izip,
14+
)
15+
16+
fromgitdb.utils.encodingimport (# noqa
17+
string_types,
18+
text_type
19+
)

‎git/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
configuration files"""
88

99
importre
10-
importConfigParserascp
10+
try:
11+
importConfigParserascp
12+
exceptImportError:
13+
# PY3
14+
importconfigparserascp
1115
importinspect
1216
importlogging
1317

‎git/db.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
"""Module with our own gitdb implementation - it uses the git command"""
2-
fromexcimport (
3-
GitCommandError,
4-
BadObject
5-
)
6-
72
fromgitdb.baseimport (
83
OInfo,
94
OStream
105
)
11-
126
fromgitdb.utilimport (
137
bin_to_hex,
148
hex_to_bin
159
)
1610
fromgitdb.dbimportGitDB
1711
fromgitdb.dbimportLooseObjectDB
1812

13+
from .excimport (
14+
GitCommandError,
15+
BadObject
16+
)
17+
1918

2019
__all__= ('GitCmdObjectDB','GitDB')
2120

‎git/diff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
76
importre
8-
fromobjects.blobimportBlob
9-
fromobjects.utilimportmode_str_to_int
107

118
fromgitdb.utilimporthex_to_bin
129

10+
from .objects.blobimportBlob
11+
from .objects.utilimportmode_str_to_int
12+
1313

1414
__all__= ('Diffable','DiffIndex','Diff')
1515

‎git/index/base.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@
88
importsys
99
importsubprocess
1010
importglob
11-
fromcStringIOimportStringIO
11+
fromioimportStringIO
1212

1313
fromstatimportS_ISLNK
1414

15-
fromtypimport (
15+
from.typimport (
1616
BaseIndexEntry,
1717
IndexEntry,
1818
)
1919

20-
fromutilimport (
20+
from.utilimport (
2121
TemporaryFileSwap,
2222
post_clear_cache,
2323
default_index,
2424
git_working_dir
2525
)
2626

2727
importgit.diffasdiff
28-
2928
fromgit.excimport (
3029
GitCommandError,
3130
CheckoutError
@@ -40,6 +39,7 @@
4039
)
4140

4241
fromgit.objects.utilimportSerializable
42+
fromgit.compatimportizip
4343

4444
fromgit.utilimport (
4545
LazyMixin,
@@ -49,7 +49,7 @@
4949
to_native_path_linux,
5050
)
5151

52-
fromfunimport (
52+
from.funimport (
5353
entry_key,
5454
write_cache,
5555
read_cache,
@@ -62,7 +62,6 @@
6262
fromgitdb.baseimportIStream
6363
fromgitdb.dbimportMemoryDB
6464
fromgitdb.utilimportto_bin_sha
65-
fromitertoolsimportizip
6665

6766
__all__= ('IndexFile','CheckoutError')
6867

‎git/index/fun.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
S_IFGITLINK=S_IFLNK|S_IFDIR# a submodule
1414

15-
fromcStringIOimportStringIO
15+
fromioimportStringIO
1616

1717
fromgit.utilimportIndexFileSHA1Writer
1818
fromgit.excimportUnmergedEntriesError
@@ -22,15 +22,15 @@
2222
traverse_trees_recursive
2323
)
2424

25-
fromtypimport (
25+
from.typimport (
2626
BaseIndexEntry,
2727
IndexEntry,
2828
CE_NAMEMASK,
2929
CE_STAGESHIFT
3030
)
3131
CE_NAMEMASK_INV=~CE_NAMEMASK
3232

33-
fromutilimport (
33+
from.utilimport (
3434
pack,
3535
unpack
3636
)
@@ -49,7 +49,7 @@ def stat_mode_to_index_mode(mode):
4949
returnS_IFLNK
5050
ifS_ISDIR(mode)orS_IFMT(mode)==S_IFGITLINK:# submodules
5151
returnS_IFGITLINK
52-
returnS_IFREG|0644| (mode&0100)# blobs with or without executable bit
52+
returnS_IFREG|0o644| (mode&0o100)# blobs with or without executable bit
5353

5454

5555
defwrite_cache(entries,stream,extension_data=None,ShaStreamCls=IndexFileSHA1Writer):

‎git/index/typ.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
"""Module with additional types used by the index"""
22

3-
fromutilimport (
3+
frombinasciiimportb2a_hex
4+
5+
from .utilimport (
46
pack,
57
unpack
68
)
9+
fromgit.objectsimportBlob
710

8-
frombinasciiimport (
9-
b2a_hex,
10-
)
1111

12-
fromgit.objectsimportBlob
1312
__all__= ('BlobFilter','BaseIndexEntry','IndexEntry')
1413

1514
#{ Invariants

‎git/objects/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
from .baseimport*
88
# Fix import dependency - add IndexObject to the util module, so that it can be
99
# imported by the submodule.base
10-
from .submoduleimportutil
11-
util.IndexObject=IndexObject
12-
util.Object=Object
10+
from .submoduleimportutilassmutil
11+
smutil.IndexObject=IndexObject
12+
smutil.Object=Object
13+
del(smutil)
1314
from .submodule.baseimport*
1415
from .submodule.rootimport*
1516

‎git/objects/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6+
from .utilimportget_object_type_by_name
67
fromgit.utilimportLazyMixin,join_path_native,stream_copy
7-
fromutilimportget_object_type_by_name
88
fromgitdb.utilimport (
99
bin_to_hex,
1010
basename

‎git/objects/blob.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
76
frommimetypesimportguess_type
8-
importbase
7+
from .importbase
98

109
__all__= ('Blob', )
1110

‎git/objects/commit.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,32 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66

7+
fromgitdbimportIStream
8+
fromgitdb.utilimporthex_to_bin
79
fromgit.utilimport (
810
Actor,
911
Iterable,
1012
Stats,
1113
finalize_process
1214
)
1315
fromgit.diffimportDiffable
14-
fromtreeimportTree
15-
fromgitdbimportIStream
16-
fromcStringIOimportStringIO
1716

18-
importbase
19-
fromgitdb.utilimport (
20-
hex_to_bin
21-
)
22-
fromutilimport (
17+
from .treeimportTree
18+
from .importbase
19+
from .utilimport (
2320
Traversable,
2421
Serializable,
2522
parse_date,
2623
altz_to_utctz_str,
2724
parse_actor_and_date
2825
)
26+
2927
fromtimeimport (
3028
time,
3129
altzone
3230
)
3331
importos
32+
fromioimportStringIO
3433
importlogging
3534

3635
log=logging.getLogger('git.objects.commit')

‎git/objects/submodule/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
importutil
2-
fromutilimport (
1+
from .importutil
2+
from.utilimport (
33
mkhead,
44
sm_name,
55
sm_section,
@@ -8,7 +8,7 @@
88
find_first_remote_branch
99
)
1010
fromgit.objects.utilimportTraversable
11-
fromStringIOimportStringIO# need a dict to set bloody .name field
11+
fromioimportStringIO# need a dict to set bloody .name field
1212
fromgit.utilimport (
1313
Iterable,
1414
join_path_native,

‎git/objects/submodule/root.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
frombaseimportSubmodule,UpdateProgress
2-
fromutilimport (
1+
from .baseimport (
2+
Submodule,
3+
UpdateProgress
4+
)
5+
from .utilimport (
36
find_first_remote_branch
47
)
58
fromgit.excimportInvalidGitRepositoryError

‎git/objects/submodule/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
importgit
22
fromgit.excimportInvalidGitRepositoryError
33
fromgit.configimportGitConfigParser
4-
fromStringIOimportStringIO
4+
fromioimportStringIO
55
importweakref
66

77
__all__= ('sm_section','sm_name','mkhead','unbare_repo','find_first_remote_branch',

‎git/objects/tag.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
""" Module containing all object based types. """
7-
importbase
8-
fromgitdb.utilimporthex_to_bin
9-
fromutilimport (
7+
from .importbase
8+
from .utilimport (
109
get_object_type_by_name,
1110
parse_actor_and_date
1211
)
12+
fromgitdb.utilimporthex_to_bin
1313

1414
__all__= ("TagObject", )
1515

‎git/objects/tree.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
importutil
7-
frombaseimportIndexObject
86
fromgit.utilimportjoin_path
9-
fromblobimportBlob
10-
fromsubmodule.baseimportSubmodule
117
importgit.diffasdiff
8+
fromgitdb.utilimportto_bin_sha
129

13-
fromfunimport (
10+
from .importutil
11+
from .baseimportIndexObject
12+
from .blobimportBlob
13+
from .submodule.baseimportSubmodule
14+
15+
from .funimport (
1416
tree_entries_from_data,
1517
tree_to_stream
1618
)
1719

18-
fromgitdb.utilimport (
19-
to_bin_sha,
20-
)
21-
2220
__all__= ("TreeModifier","Tree")
2321

2422

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp