Utils format fixes

This commit is contained in:
Kevin Froman 2020-08-12 18:07:04 -05:00
parent c9af24392d
commit 2a7c933321
3 changed files with 17 additions and 14 deletions

View File

@ -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 <https://www.gnu.org/licenses/>.
'''
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))
return re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]').sub('', str(data))

View File

@ -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 <https://www.gnu.org/licenses/>.
"""
from . import identifyhome
import filepaths
def get_hostname():

View File

@ -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: