You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/04/25 02:16:13 UTC

[incubator-teaclave] branch master updated: Format/lint all python code

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


The following commit(s) were added to refs/heads/master by this push:
     new ea3045b  Format/lint all python code
ea3045b is described below

commit ea3045b59ea77d8d47bd00cc42f6ffc00def0992
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Fri Apr 24 18:34:30 2020 -0700

    Format/lint all python code
---
 cmake/scripts/gen_enclave_info_toml.py            |  2 ++
 services/access_control/python/acs_engine_test.py | 12 ++++++------
 services/access_control/python/ffi.py             |  4 ++--
 tests/scripts/simple_http_server.py               |  4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/cmake/scripts/gen_enclave_info_toml.py b/cmake/scripts/gen_enclave_info_toml.py
index f425aad..1bc30da 100644
--- a/cmake/scripts/gen_enclave_info_toml.py
+++ b/cmake/scripts/gen_enclave_info_toml.py
@@ -1,11 +1,13 @@
 import sys
 
+
 def find_hex_value(content, section):
     index = content.index(section)
     # assume each element in content is ending with '\n'
     hex_bytes = ''.join(content[index+1:index+3]).split()
     return ''.join(['%02x' % int(x, 16) for x in hex_bytes])
 
+
 mr_signer = "mrsigner->value:\n"
 mr_enclave = "metadata->enclave_css.body.enclave_hash.m:\n"
 
diff --git a/services/access_control/python/acs_engine_test.py b/services/access_control/python/acs_engine_test.py
index b951d41..5ec5495 100644
--- a/services/access_control/python/acs_engine_test.py
+++ b/services/access_control/python/acs_engine_test.py
@@ -20,15 +20,15 @@ if __name__ == '__main__':
     IRRELEVANT_TASK           = "task_irrelevant"
     IRRELEVANT_PARTY          = "usr_irrelevant"
     IRRELEVANT_DATA           = "data_irrelevant"
-    
+
     acs_announce_fact('task_creator', repr([FUSION_TASK, FUSION_TASK_PARTY_1]))
     acs_announce_fact('task_participant', repr([FUSION_TASK, FUSION_TASK_PARTY_1]))
     acs_announce_fact('task_participant', repr([FUSION_TASK, FUSION_TASK_PARTY_2]))
-    
+
     acs_announce_fact('data_owner', repr([FUSION_TASK_DATA_1, FUSION_TASK_PARTY_1]))
     acs_announce_fact('data_owner', repr([FUSION_TASK_DATA_2, FUSION_TASK_PARTY_2]))
     acs_announce_fact('data_owner', repr([IRRELEVANT_DATA, IRRELEVANT_PARTY]))
-    
+
     acs_announce_fact('script_owner', repr([FUSION_TASK_SCRIPT, FUSION_TASK_SCRIPT_WRITER]))
 
     acs_announce_fact('script_owner', repr([PUBLIC_SCRIPT, PUBLIC_SCRIPT_WRITER]))
@@ -39,14 +39,14 @@ if __name__ == '__main__':
     assert not acs_enforce_request('launch_task', repr([FUSION_TASK, set()]))
     assert not acs_enforce_request('launch_task', repr([FUSION_TASK, set([FUSION_TASK_PARTY_1])]))
     assert not acs_enforce_request('launch_task', repr([FUSION_TASK, set([FUSION_TASK_PARTY_2])]))
-    
+
     assert acs_enforce_request('access_data', repr([FUSION_TASK, FUSION_TASK_DATA_1]))
     assert acs_enforce_request('access_data', repr([FUSION_TASK, FUSION_TASK_DATA_2]))
     assert not acs_enforce_request('access_data', repr([FUSION_TASK, IRRELEVANT_DATA]))
 
     assert acs_enforce_request('access_script', repr([FUSION_TASK, PUBLIC_SCRIPT]))
     assert not acs_enforce_request('access_script', repr([FUSION_TASK, FUSION_TASK_SCRIPT]))
-    
+
     acs_announce_fact('task_participant', repr([FUSION_TASK, FUSION_TASK_SCRIPT_WRITER]))
     assert acs_enforce_request('access_script', repr([FUSION_TASK, FUSION_TASK_SCRIPT]))
 
@@ -56,7 +56,7 @@ if __name__ == '__main__':
     acs_announce_fact('task_creator', repr([IRRELEVANT_TASK, IRRELEVANT_PARTY]))
     acs_announce_fact('task_participant', repr([IRRELEVANT_TASK, IRRELEVANT_PARTY]))
     acs_announce_fact('task_participant', repr([IRRELEVANT_TASK, FUSION_TASK_PARTY_2]))
-    
+
     assert acs_enforce_request('launch_task', repr([IRRELEVANT_TASK, set([IRRELEVANT_PARTY, FUSION_TASK_PARTY_2])]))
     assert not acs_enforce_request('access_data', repr([IRRELEVANT_TASK, FUSION_TASK_DATA_1]))
     assert acs_enforce_request('access_data', repr([IRRELEVANT_TASK, FUSION_TASK_DATA_2]))
diff --git a/services/access_control/python/ffi.py b/services/access_control/python/ffi.py
index 3f56be7..62895ae 100644
--- a/services/access_control/python/ffi.py
+++ b/services/access_control/python/ffi.py
@@ -5,9 +5,9 @@ import _cffi_backend as backend
 ffi = sgx_cffi.FFI(backend)
 
 ffi.embedding_api("int acs_setup_model(const char *configuration);")
-ffi.embedding_api("""int acs_enforce_request(const char *request_type, 
+ffi.embedding_api("""int acs_enforce_request(const char *request_type,
                                              const char *request_content);""")
-ffi.embedding_api("""int acs_announce_fact(const char *term_type, 
+ffi.embedding_api("""int acs_announce_fact(const char *term_type,
                                            const char *term_fact);""")
 with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "acs_engine.py")) as f:
     ffi.embedding_init_code(f.read())
diff --git a/tests/scripts/simple_http_server.py b/tests/scripts/simple_http_server.py
index c6f0e86..e3386c5 100644
--- a/tests/scripts/simple_http_server.py
+++ b/tests/scripts/simple_http_server.py
@@ -1,5 +1,5 @@
 import SimpleHTTPServer
-import BaseHTTPServer
+
 
 class HTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
     def do_PUT(self):
@@ -14,4 +14,4 @@ class HTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
 
 
 if __name__ == '__main__':
-    SimpleHTTPServer.test(HandlerClass=HTTPRequestHandler)
\ No newline at end of file
+    SimpleHTTPServer.test(HandlerClass=HTTPRequestHandler)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org