# Path: config.py
# def editbatconfig(section,item,itemvalue):
# def loadconfig():


import sys
import time
from os import rename
from shutil import copy as filecopy
from copy import deepcopy
from ast import literal_eval
from configparser import SafeConfigParser
from config import config,loadconfig
    return lines

def avv():
  vstr=""
  v=[0.0 for i in range(numcells)]
  endlog=tail(config['files']['logfile'],11)
  for j in range(numcells):
    for i in range(10):
      x=float(endlog[i][j*6+15:j*6+20])
      v[j]=v[j]+x
  for i in range(len(v)):
    v[i]=v[i]/10
    vstr=vstr+str(i+1) + "=" +str(round(v[i],3)).ljust(5,'0') + ", "
  print(vstr)
  print(config['calibrate']['delta'])
  return v



def getv():
  global voltages
  try:
    summaryfile.read(config['files']['summaryfile'])
  except IOError:
    pass
  voltages=literal_eval(summaryfile.get('current','maxvoltages'))
  vprint = ''
  for i in range(numcells+1):
    vprint = vprint + str(i+1) + '=' + str(voltages[i]).ljust(5,'0') + ', '
  print(vprint)

# Path: config.py
# def editbatconfig(section,item,itemvalue):
# def loadconfig():


# Path: calvfine.py
import sys
import time
from os import rename
from shutil import copy as filecopy
from copy import deepcopy
from ast import literal_eval
from configparser import SafeConfigParser
from config import config,loadconfig

    return lines

def avv():
  vstr=""
  v=[0.0 for i in range(numcells)]
  endlog=tail(config['files']['logfile'],11)
  for j in range(numcells):
    for i in range(10):
      x=float(endlog[i][j*6+15:j*6+20])
      v[j]=v[j]+x
  for i in range(len(v)):
    v[i]=v[i]/10
    vstr=vstr+str(i+1) + "=" +str(round(v[i],3)).ljust(5,'0') + ", "
  print(vstr)
  print(config['calibrate']['delta'])
  return v



def getv():
  global voltages
  try:
    summaryfile.read(config['files']['summaryfile'])
  except IOError:
    pass
  voltages=literal_eval(summaryfile.get('current','maxvoltages'))
  vprint = ''
  for i in range(numcells+1):
    vprint = vprint + str(i+1) + '=' + str(voltages[i]).ljust(5,'0') + ', '
  print(vprint)

  print(config['calibrate']['delta'])