Commit 82b17ccf authored by Yori Fournier's avatar Yori Fournier
Browse files

start the cleaning: __init__ is now in better shape

parent 988058dd
Pipeline #507 failed with stage
in 5 minutes and 47 seconds
......@@ -2,10 +2,10 @@ from .mpl_data import MplData
# TECHNICAL ------------------------------------------------------------
D_VERSION='v5'
D_HIERARCHY='LOCAL'
CONTEXT='LOCAL'
D_HOST='localhost'
D_PORT=50803
CONTEXT=D_HIERARCHY
# FORM -----------------------------------------------------------------
INFO = " > info-: "
......
......@@ -34,7 +34,7 @@
#
# IMPORT ---------------------------------------------------------------
from .config import INFO, WARN, SEVR, DBUG, SPCE
from .config import D_HIERARCHY, CONTEXT
from .config import CONTEXT
import os as os
import numpy as np
......@@ -45,9 +45,9 @@ from mpl_unpickler import MplUnpickler
np.set_printoptions(threshold='nan')
# matplotlib import for client/local -----------------------------------
if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'):
if CONTEXT.lower() in ('client', 'local'):
if D_HIERARCHY in ('CLIENT', 'client'):
if CONTEXT.lower() == 'client':
print(INFO + 'Import ' + __package__ + ' as a client.')
else:
print(INFO + 'Import ' + __package__ + ' for local use.')
......@@ -56,22 +56,11 @@ if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'):
from matplotlib import __version__ as mplvers
if int(mplvers.replace('.', '')[:3]) < 143:
print(
'\n\n' +
WARN +
72 *
'=' +
'\n' +
SPCE +
'The matplotlib version you are using is not supported.\n' +
SPCE +
'Most of myplotlib should work, but some stuff may not.\n' +
SPCE +
'ex: expect an error with test203\n' +
SPCE +
72 *
'=' +
'\n\n')
print('\n\n' \
'{warn} {sep} \n' \
'{spce} The matplotlib version you are using is not supported.\n' \
'{spce} Most of myplotlib should work, but some stuff may not.\n' \
'{spce} {sep} \n\n'.format(warn=WARN, spce=SPCE, sep=72*'='))
# matplotlib
from matplotlib.pyplot import figure
......@@ -87,14 +76,14 @@ if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'):
from .config import D_HOST, D_PORT
from socket import socket, AF_INET, SOCK_STREAM
elif D_HIERARCHY in ('SERVER', 'server'):
elif CONTEXT.lower() == 'server':
if DBUG:
print(INFO + 'Import ' + __package__ + ' as a server.')
from .config import D_HOST, D_PORT
from socket import socket, AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
else:
print(SEVR + 'the value of D_HIERARCHY has to be SERVER or CLIENT')
print(SEVR + 'the value of CONTEXT has to be SERVER, CLIENT or LOCAL')
raise ImportError
# myplotlib
......@@ -107,66 +96,30 @@ from .config import D_IPATH
from .config import D_OPATH, D_OFORMAT
from .config import D_DEBUG
if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'):
if CONTEXT.lower() in ('client', 'local'):
from .rconfig import rcParams
from .mpl_axes import MplAxes
from .mpl_grid import Grid, VerticalGrid, HorizontalGrid
from .mpl_fig import MplFig
if D_HIERARCHY in ('CLIENT', 'client'):
# MplAxes: Overlay on matplotlib.Axes class
# from .mpl_axes_client import MplAxesClient as MplAxes
from .mpl_axes import MplAxes
from .mpl_grid import Grid, VerticalGrid, HorizontalGrid
# MplFig: Overlay on matplotlib.Figure class
# from .mpl_fig_client import MplFigClient as MplFig
from .mpl_fig import MplFig
from .progressbar import ProgressBar
from .mpl_client import MplClient
elif(D_HIERARCHY in ('SERVER', 'server')):
# MplAxes: Overlay on matplotlib.Axes class
# from .mpl_axes_server import MplAxesServer as MplAxes
from .mpl_axes import MplAxes
from .mpl_grid import Grid, VerticalGrid, HorizontalGrid
from .empty_fig import EmptyFig
from .empty_axes import EmptyAxes
# MplFig: Overlay on matplotlib.Figure class
# from .mpl_fig_server import MplFigServer as MplFig
from .mpl_fig import MplFig
from .progressbar import ProgressBar
from .mpl_client import MplClient
SERVER_IOFUNCTIONS = {
# 'readStupidData': readStupidData,
# 'readStupidData2': readStupidData2
}
SERVER_FIGURES = {
# 'FigTest': FigTest
}
from .mpl_server import MplServer, MplHandler
elif D_HIERARCHY in ('LOCAL', 'local'):
# MplAxes: Overlay on matplotlib.Axes class
from .mpl_axes import MplAxes
# MplFig: Overlay on matplotlib.Figure class
from .mpl_grid import Grid, VerticalGrid, HorizontalGrid
from .mpl_fig import MplFig
from .empty_fig import EmptyFig
from .empty_axes import EmptyAxes
else:
print(SEVR + 'the value of D_HIERARCHY has to be SERVER, CLIENT or LOCAL')
raise ImportError
SERVER_IOFUNCTIONS = {
# 'readStupidData': readStupidData,
# 'readStupidData2': readStupidData2
}
SERVER_FIGURES = {
# 'FigTest': FigTest
}
from .mpl_server import MplServer, MplHandler
if D_HIERARCHY in ('CLIENT', 'client', 'LOCAL', 'local'):
if CONTEXT.lower() in ('client', 'local'):
_G_WINDOWS = []
......
......@@ -31,10 +31,10 @@
#
#
# IMPORT ---------------------------------------------------------------
from . import D_HIERARCHY
from . import CONTEXT
from . import INFO, SPCE, DBUG
if D_HIERARCHY in ('CLIENT', 'client', 'local', 'LOCAL'):
if CONTEXT in ('CLIENT', 'client', 'local', 'LOCAL'):
from . import myTest
from .test import __dict__ as avail_tests
else:
......
......@@ -2,10 +2,10 @@ from .mpl_data import MplData
# TECHNICAL ------------------------------------------------------------
D_VERSION='v5'
D_HIERARCHY='LOCAL'
CONTEXT='LOCAL'
D_HOST='localhost'
D_PORT=50803
CONTEXT = D_HIERARCHY
# FORM -----------------------------------------------------------------
INFO = " > info-: "
......
......@@ -2,10 +2,10 @@ from .mpl_data import MplData
# TECHNICAL ------------------------------------------------------------
D_VERSION='v5'
D_HIERARCHY='CLIENT'
CONTEXT='CLIENT'
D_HOST='localhost'
D_PORT=50803
CONTEXT = D_HIERARCHY
# FORM -----------------------------------------------------------------
INFO = " > info-: "
......
......@@ -2,10 +2,10 @@ from .mpl_data import MplData
# TECHNICAL ------------------------------------------------------------
D_VERSION='v5'
D_HIERARCHY='SERVER'
CONTEXT='SERVER'
D_HOST='localhost'
D_PORT=50803
CONTEXT = D_HIERARCHY
# FORM -----------------------------------------------------------------
INFO = " > info-: "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment