Remove unneeded import and function

This commit is contained in:
Jonathan van der Steege 2022-06-20 22:50:25 +02:00
parent 18bae71d95
commit 24c2ce2d3d

View file

@ -19,7 +19,6 @@ from jrnl.messages import MsgStyle
from .path import home_dir
from collections import Counter
# Constants
DEFAULT_CONFIG_NAME = "jrnl.yaml"
@ -227,48 +226,3 @@ def get_journal_name(args, config):
logging.debug("Using journal name: %s", args.journal_name)
return args
def config_duplicate_keys(config_path):
if is_config_json(config_path):
return None
duplicate_keys = []
with open(config_path) as f:
keys = []
current_serie = []
temp_store = []
leading_spaces = 0
for line in f:
line_lead = len(line) - len(line.lstrip(" "))
if line_lead > leading_spaces:
temp_store.append(current_serie)
current_serie = []
elif line_lead < leading_spaces:
while (leading_spaces - line_lead) > 2:
keys.append(current_serie)
current_serie = temp_store.pop()
leading_spaces -= 2
keys.append(current_serie)
current_serie = temp_store.pop()
current_serie.append(line.strip().split(":")[0])
leading_spaces = line_lead
keys.append(current_serie)
for serie in keys:
count = Counter(serie)
for i in count.keys():
if count[i] > 1:
duplicate_keys.append(i)
if len(duplicate_keys) > 0:
return duplicate_keys
return None