Skip to content

Commit

Permalink
make platform info default
Browse files Browse the repository at this point in the history
  • Loading branch information
tokeefe committed Dec 10, 2024
1 parent e99ddaa commit 0523c04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 12 additions & 0 deletions scanbuddy/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys
import platform
from tabulate import tabulate

def print_platform_info():
table = [
['Platform', platform.platform()],
['Processor', platform.processor()],
['Python version', platform.python_version()],
['GIL enabled', sys._is_gil_enabled()]
]
print(tabulate(table, tablefmt='simple_grid'))
16 changes: 2 additions & 14 deletions scripts/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import sys
import time
import logging
import platform
from pubsub import pub
from pathlib import Path
from tabulate import tabulate
from argparse import ArgumentParser
from scanbuddy.watcher.directory import DirectoryWatcher
from scanbuddy.common import print_platform_info
from scanbuddy.proc import Processor
from scanbuddy.proc.volreg import VolReg
from scanbuddy.proc.params import Params
Expand All @@ -27,14 +26,12 @@ def main():
parser.add_argument('--host', type=str, default='127.0.0.1')
parser.add_argument('--port', type=int, default=8080)
parser.add_argument('--folder', type=Path, required=True)
parser.add_argument('--platform-info', action='store_true')
parser.add_argument('--snr-interval', default=10,
help='Every N volumes snr should be calculated')
parser.add_argument('-v', '--verbose', action='store_true')
args = parser.parse_args()

if args.platform_info:
print_platform_info()
print_platform_info()

config = Config(args.config)

Expand Down Expand Up @@ -67,14 +64,5 @@ def main():
watcher.start()
view.forever()

def print_platform_info():
table = [
['Platform', platform.platform()],
['Processor', platform.processor()],
['Python version', platform.python_version()],
['GIL enabled', sys._is_gil_enabled()]
]
print(tabulate(table))

if __name__ == '__main__':
main()

0 comments on commit 0523c04

Please sign in to comment.