Skip to content

Ruff format #38

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
target-version = "py310"
exclude = ["*_pb2.py"]

line-length = 100
[format]
indent-style = "space"
quote-style = "double"

[lint]
select = [
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
]
ignore = [
"B905", # new 'strict' argument for zip in python3.10
"E501", # ignore line length errors for now
"E701", # multiple statements on one line, will be fixed by format
"E722", # do not use bare except
"E741", # ambiguous variable name (seems to trigger on l, I, and such)
"F841", # unused local variable
"SIM105", # contextlib.suppress is 3x slower than try-except
"SIM115", # use context manager to open files (only works in some places)
]
2 changes: 1 addition & 1 deletion cnc/protocol/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# SPDX-FileCopyrightText: 2023 Carnegie Mellon University - Satyalab
#
# SPDX-License-Identifier: GPL-2.0-only
# SPDX-License-Identifier: GPL-2.0-only
28 changes: 15 additions & 13 deletions cnc/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,42 @@
#
# SPDX-License-Identifier: GPL-2.0-only

from gabriel_server.network_engine import server_runner
import logging
import argparse
import logging

from gabriel_server.network_engine import server_runner

DEFAULT_PORT = 9099
DEFAULT_NUM_TOKENS = 2
INPUT_QUEUE_MAXSIZE = 60
SOURCE = 'cnc'
SOURCE = "cnc"

logging.basicConfig(level=logging.INFO)

logger = logging.getLogger(__name__)


def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
"-t", "--tokens", type=int, default=DEFAULT_NUM_TOKENS, help="number of tokens"
)

parser.add_argument(
"-p", "--port", type=int, default=DEFAULT_PORT, help="Set port number"
)

parser.add_argument("-p", "--port", type=int, default=DEFAULT_PORT, help="Set port number")

parser.add_argument(
"-q", "--queue", type=int, default=INPUT_QUEUE_MAXSIZE, help="Max input queue size"
)

args, _ = parser.parse_known_args()

server_runner.run(websocket_port=args.port, zmq_address='tcp://*:5555', num_tokens=args.tokens,
input_queue_maxsize=args.queue)
server_runner.run(
websocket_port=args.port,
zmq_address="tcp://*:5555",
num_tokens=args.tokens,
input_queue_maxsize=args.queue,
)


if __name__ == "__main__":
main()
Loading