Skip to content

Commit

Permalink
Merge 69b0f4f into be2ec50
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Sep 8, 2019
2 parents be2ec50 + 69b0f4f commit 85652a4
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 58 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ docs:

.PHONY: coverage
coverage:
coverage run --source adb setup.py test && coverage html && coverage report
coverage run --source adb setup.py test && coverage html && coverage report -m

.PHONY: lint
lint:
flake8 adb/ && pylint adb/

.PHONY: alltests
alltests:
flake8 adb/ && pylint adb/ && coverage run --source adb setup.py test && coverage report -m
78 changes: 39 additions & 39 deletions adb/CHECKLIST.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
# Linting

[x] `adb_commands.py`
[x] `adb_debug.py`
[x] `adb_protocol.py`
[x] `common_cli.py`
[x] `common.py`
[x] `fastboot_debug.py`
[x] `fastboot.py`
[x] `filesync_protocol.py`
[x] `__init__.py`
[x] `sign_cryptography.py`
[x] `sign_pycryptodome.py`
[x] `sign_pythonrsa.py`
[x] `usb_exceptions.py`
- [x] `adb_commands.py`
- [x] `adb_debug.py`
- [x] `adb_protocol.py`
- [x] `common_cli.py`
- [x] `common.py`
- [x] `fastboot_debug.py`
- [x] `fastboot.py`
- [x] `filesync_protocol.py`
- [x] `__init__.py`
- [x] `sign_cryptography.py`
- [x] `sign_pycryptodome.py`
- [x] `sign_pythonrsa.py`
- [x] `usb_exceptions.py`


# Documentation Skeleton

[x] `adb_commands.py`
[x] `adb_debug.py`
[x] `adb_protocol.py`
[ ] `common_cli.py`
[ ] `common.py`
[ ] `fastboot_debug.py`
[ ] `fastboot.py`
[ ] `filesync_protocol.py`
[ ] `__init__.py`
[ ] `sign_cryptography.py`
[ ] `sign_pycryptodome.py`
[ ] `sign_pythonrsa.py`
[ ] `usb_exceptions.py`
- [x] `adb_commands.py`
- [x] `adb_debug.py`
- [x] `adb_protocol.py`
- [ ] `common_cli.py`
- [ ] `common.py`
- [ ] `fastboot_debug.py`
- [ ] `fastboot.py`
- [ ] `filesync_protocol.py`
- [x] `__init__.py`
- [x] `sign_cryptography.py`
- [x] `sign_pycryptodome.py`
- [x] `sign_pythonrsa.py`
- [x] `usb_exceptions.py`



# Documentation Complete

[ ] `adb_commands.py`
[ ] `adb_debug.py`
[ ] `adb_protocol.py`
[ ] `common_cli.py`
[ ] `common.py`
[ ] `fastboot_debug.py`
[ ] `fastboot.py`
[ ] `filesync_protocol.py`
[ ] `__init__.py`
[ ] `sign_cryptography.py`
[ ] `sign_pycryptodome.py`
[ ] `sign_pythonrsa.py`
[ ] `usb_exceptions.py`
- [ ] `adb_commands.py`
- [ ] `adb_debug.py`
- [ ] `adb_protocol.py`
- [ ] `common_cli.py`
- [ ] `common.py`
- [ ] `fastboot_debug.py`
- [ ] `fastboot.py`
- [ ] `filesync_protocol.py`
- [x] `__init__.py`
- [ ] `sign_cryptography.py`
- [ ] `sign_pycryptodome.py`
- [ ] `sign_pythonrsa.py`
- [ ] `usb_exceptions.py`

9 changes: 4 additions & 5 deletions adb/sign_cryptography.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class CryptographySigner(adb_protocol.AuthSigner):
Attributes
----------
public_key : TODO
TODO
public_key : str
The contents of the public key file
rsa_key : TODO
TODO
Expand All @@ -65,16 +65,15 @@ def Sign(self, data):
The signed ``data``
"""
return self.rsa_key.sign(
data, padding.PKCS1v15(), utils.Prehashed(hashes.SHA1()))
return self.rsa_key.sign(data, padding.PKCS1v15(), utils.Prehashed(hashes.SHA1()))

def GetPublicKey(self):
"""Returns the public key in PEM format without headers or newlines.
Returns
-------
self.public_key : str
The public key
The contents of the public key file
"""
return self.public_key
14 changes: 7 additions & 7 deletions adb/sign_pycryptodome.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class PycryptodomeAuthSigner(adb_protocol.AuthSigner):
Parameters
----------
rsa_key_path : TODO, None
TODO
rsa_key_path : str, None
The path to the private key
Attributes
----------
public_key : TODO
TODO
rsa_key : TODO
TODO
public_key : str
The contents of the public key file
rsa_key : str
The contents of the private key file
"""
def __init__(self, rsa_key_path=None):
Expand Down Expand Up @@ -74,7 +74,7 @@ def GetPublicKey(self):
Returns
-------
self.public_key : str
The public key
The contents of the public key file
"""
return self.public_key
15 changes: 11 additions & 4 deletions adb/sign_pythonrsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ def __init__(self):
self._buf = b''

def update(self, msg):
"""TODO"""
"""TODO
Parameters
----------
msg : TODO
TODO
"""
self._buf += msg

def digest(self):
Expand Down Expand Up @@ -108,7 +115,7 @@ class PythonRSASigner(adb_protocol.AuthSigner):
----------
priv_key : TODO
TODO
pub_key : TODO
pub_key : TODO, None
TODO
"""
Expand All @@ -118,7 +125,7 @@ def __init__(self, pub=None, priv=None):

@classmethod
def FromRSAKeyPath(cls, rsa_key_path):
"""TODO
"""Create a :class:`PythonRSASigner` instance using the provided private key.
Parameters
----------
Expand All @@ -128,7 +135,7 @@ def FromRSAKeyPath(cls, rsa_key_path):
Returns
-------
PythonRSASigner
TODO
A :class:`PythonRSASigner` with private key ``rsa_key_path`` and public key ``rsa_key_path + '.pub'``
"""
with open(rsa_key_path + '.pub') as f:
Expand Down
3 changes: 1 addition & 2 deletions adb/usb_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def __init__(self, msg, usb_error):
self.usb_error = usb_error

def __str__(self):
return '%s: %s' % (
super(LibusbWrappingError, self).__str__(), str(self.usb_error))
return '%s: %s' % (super(LibusbWrappingError, self).__str__(), str(self.usb_error))


class WriteFailedError(LibusbWrappingError):
Expand Down

0 comments on commit 85652a4

Please sign in to comment.