From 2a7c933321e8440b89629705c57190115cc4b502 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Wed, 12 Aug 2020 18:07:04 -0500 Subject: [PATCH] Utils format fixes --- src/utils/colors.py | 22 +++++++++++----------- src/utils/gethostname.py | 4 ++-- src/utils/gettransports.py | 5 ++++- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/utils/colors.py b/src/utils/colors.py index 03da5c70..6a1edc2d 100644 --- a/src/utils/colors.py +++ b/src/utils/colors.py @@ -1,9 +1,9 @@ -''' - Onionr - Private P2P Communication +"""Onionr - Private P2P Communication. - class to access ANSI control codes -''' -''' +class to access ANSI control codes +""" +import re +""" This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -16,12 +16,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -''' -import re +""" + + class Colors: - ''' - This class allows you to set the color if ANSI codes are supported - ''' + """ANSI color code collection.""" reset='\033[0m' bold='\033[01m' disable='\033[02m' @@ -57,4 +56,5 @@ class Colors: lightgrey='\033[47m' @staticmethod def filter(data): - return re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]').sub('', str(data)) \ No newline at end of file + return re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]').sub('', str(data)) + \ No newline at end of file diff --git a/src/utils/gethostname.py b/src/utils/gethostname.py index 74aee7bc..8450ad60 100644 --- a/src/utils/gethostname.py +++ b/src/utils/gethostname.py @@ -2,6 +2,8 @@ Get the node's Tor hostname """ +from . import identifyhome +import filepaths """ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,8 +18,6 @@ Get the node's Tor hostname You should have received a copy of the GNU General Public License along with this program. If not, see . """ -from . import identifyhome -import filepaths def get_hostname(): diff --git a/src/utils/gettransports.py b/src/utils/gettransports.py index 2e51a0e7..77e4286c 100644 --- a/src/utils/gettransports.py +++ b/src/utils/gettransports.py @@ -31,7 +31,8 @@ class _GetTor: def get(self): if self.tor_hs is None: try: - with open(filepaths.tor_hs_address_file, 'r') as transport_file: + with open(filepaths.tor_hs_address_file, 'r') as \ + transport_file: self.tor_hs = transport_file.read().strip() if not self.tor_hs: self.tor_hs = None @@ -39,8 +40,10 @@ class _GetTor: pass return self.tor_hs + _tor_getter = _GetTor() + def get(): transports = [_tor_getter.get()] for file in files: