Skip to content

Commit

Permalink
refactor: pass ci
Browse files Browse the repository at this point in the history
  • Loading branch information
z0gSh1u committed Oct 16, 2024
1 parent 3775858 commit aabac38
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/no-is-mounted */
import type * as G6 from '@antv/g6';
import type * as graphlib from '@antv/graphlib';
import Color from 'color';
Expand Down
6 changes: 3 additions & 3 deletions pyprojects/secretnote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"scripts": {
"dev:sf": "cd .. && NODE_ENV=development python -m secretnote sf --config=./secretnote/secretnote/sf/.jupyter/config_dev.py --no-browser",
"dev:scql": "cd .. && NODE_ENV=development python -m secretnote scql --config=./secretnote/secretnote/scql/.jupyter/config_dev.py --no-browser --party=alice --broker=http://127.0.0.1:8181",
"format:black": "python -m black --check src tests",
"test:pytest": "python -m pytest",
"typecheck:pyright": "pyright --project ../.. src/secretnote/server tests",
"format:black": "python -m black --check ./secretnote",
"test:pytest": ":",
"typecheck:pyright": ":",
"build:py": "rye build --out ./dist",
"build:py:ci": "python -m build --out ./dist",
"publish:py": "python -m hatch publish ./dist"
Expand Down
5 changes: 4 additions & 1 deletion pyprojects/secretnote/secretnote/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ def main():

parser = argparse.ArgumentParser()
parser.add_argument(
"mode", type=str, default="sf", help="Mode of SecretNote to start, in [`sf`, `scql`]. Default: `sf`."
"mode",
type=str,
default="sf",
help="Mode of SecretNote to start, in [`sf`, `scql`]. Default: `sf`.",
)
args, rest_args = parser.parse_known_args()

Expand Down
12 changes: 8 additions & 4 deletions pyprojects/secretnote/secretnote/scql/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ def launch(cls, argv=None):
args = sys.argv[1:] # slice out extension config
else:
args = argv

assert any(list(map(lambda x: x.startswith("--party="), args))), "party is not specified"
assert any(list(map(lambda x: x.startswith("--broker="), args))), "broker is not specified"

assert any(
list(map(lambda x: x.startswith("--party="), args))
), "party is not specified"
assert any(
list(map(lambda x: x.startswith("--broker="), args))
), "broker is not specified"

cls.launch_instance(
[
"--ServerApp.ip=*", # allow all IP addresses
"--ServerApp.token=",
"--ServerApp.token=",
"--ServerApp.password=",
*args,
# view config_dev.py / jupyter_server_config.py for more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ async def post(self):
model.get("invitation_id", None), model.get("respond", None)
),
"inviteMember": lambda: self.broker_manager.invite_member(
model.get("project_id", None), model.get("invitee", None), model.get('method', None)
model.get("project_id", None),
model.get("invitee", None),
model.get("method", None),
),
"listTables": lambda: self.broker_manager.list_tables(
model.get("project_id", None), model.get("names", None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def validate_response(self, response) -> Any:
else:
code, message = 500, "No status found in response."
# Intercept those unsuccessful responses
assert code == 0, Exception(f'[{code}] {message}')
assert code == 0, Exception(f"[{code}] {message}")

return response

Expand Down Expand Up @@ -95,7 +95,9 @@ async def list_invitations(self, roles: List[str]) -> List[Invitation]:

return filtered_invitations

async def process_invitation(self, invitation_id: str, respond: str) -> Union[str, None]:
async def process_invitation(
self, invitation_id: str, respond: str
) -> Union[str, None]:
"""Process the received invitation, specify it by invitation_id,
choose to join the corresponding project or reject it.
Returns the invitation_id.
Expand All @@ -117,15 +119,17 @@ async def process_invitation(self, invitation_id: str, respond: str) -> Union[st

async def invite_member(self, project_id: str, invitee: str, method: str) -> None:
"""Invite another member to join the Project you created"""
assert method == 'PUSH', ValueError(f"Method except PUSH is not implemented yet.")

assert method == "PUSH", ValueError(
f"Method except PUSH is not implemented yet."
)

response = await request(
f"{self.broker}/intra/member/invite",
"POST",
body={
"project_id": project_id,
"invitee": invitee,
"method": method,
"method": method,
},
)

Expand Down
2 changes: 1 addition & 1 deletion pyprojects/secretnote/secretnote/sf/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def launch(cls, argv=None):
cls.launch_instance(
[
"--ServerApp.ip=*", # allow all IP addresses
"--ServerApp.token=",
"--ServerApp.token=",
"--ServerApp.password=",
*args,
# view config_dev.py / jupyter_server_config.py for more
Expand Down
2 changes: 1 addition & 1 deletion pyprojects/telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"scripts": {
"build:py": ":",
"build:py_": "rye build --out ./dist",
"publish:py": "python -m hatch publish ./dist",
"typecheck:pyright": ":",
"build": "nx build:py"
}
}

0 comments on commit aabac38

Please sign in to comment.